org.enhydra.xml.xmlc.misc
Class LineNumberMap

java.lang.Object
  |
  +--org.enhydra.xml.xmlc.misc.LineNumberMap
Direct Known Subclasses:
LineNumberRecorder

public class LineNumberMap
extends Object

Table that keeps a map of character offsets and line count in an input stream to file name and line numbers in source files. This is used to handle mapping of indexes or line numbers in a stream generted by including files to those in the original files.


Inner Class Summary
 class LineNumberMap.Line
          Structure to record the char offset in an input stream for a line.
 
Constructor Summary
LineNumberMap()
           
 
Method Summary
 void addLine(String fileName, int lineNum, int streamLineNum, int streamCharOffset)
          Add a line to the map.
 LineNumberMap.Line getLineFromLineNum(int streamLineNum)
          Get the filname end line number for a stream character offset.
 LineNumberMap.Line getLineFromOffset(int streamCharOffset)
          Get the filname end line number for a stream line number.
 String toString()
          Get String reprsentation for debugging
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LineNumberMap

public LineNumberMap()
Method Detail

addLine

public final void addLine(String fileName,
                          int lineNum,
                          int streamLineNum,
                          int streamCharOffset)
Add a line to the map. This object currently assumes that all lines are added in sequential order.

getLineFromOffset

public final LineNumberMap.Line getLineFromOffset(int streamCharOffset)
Get the filname end line number for a stream line number.

getLineFromLineNum

public final LineNumberMap.Line getLineFromLineNum(int streamLineNum)
Get the filname end line number for a stream character offset.

toString

public String toString()
Get String reprsentation for debugging
Overrides:
toString in class Object


Copyright © 1999-2002 enhydra.org (Mark Diekhans, David Li, Richard Kunze). All Rights reserved.