Enhydra 5.1 API

org.enhydra.xml.xmlc.misc
Class LineNumberMap

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

public class LineNumberMap
extends java.lang.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.


Nested 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(java.lang.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.
 java.lang.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(java.lang.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 java.lang.String toString()
Get String reprsentation for debugging

Overrides:
toString in class java.lang.Object

Enhydra 5.1 API