Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.enhydra.xml.xmlc.misc
Class LineNumberRecorder  view LineNumberRecorder download LineNumberRecorder.java

java.lang.Object
  extended byorg.enhydra.xml.xmlc.misc.LineNumberMap
      extended byorg.enhydra.xml.xmlc.misc.LineNumberRecorder

public final class LineNumberRecorder
extends LineNumberMap

Class that records information to translate a line number or byte offset in a stream into a source file and line number.


Nested Class Summary
private  class LineNumberRecorder.FileStackEntry
           
 
Nested classes inherited from class org.enhydra.xml.xmlc.misc.LineNumberMap
LineNumberMap.Line
 
Field Summary
private  java.lang.String fFileName
          Current source file name.
private  java.util.ArrayList fFileStack
          Stack of FileStackEntry objects
private  int fLineNum
          Current line-number in the file.
private  boolean fPrevWasReturn
          Was the previous character a return?
private  int fStreamCharOffset
          Character offset in the stream.
private  int fStreamLineNum
          Line number in the stream.
 
Fields inherited from class org.enhydra.xml.xmlc.misc.LineNumberMap
 
Constructor Summary
LineNumberRecorder()
          Constructor with no initial file.
LineNumberRecorder(java.lang.String fileName)
          Constructor, setting initial file.
 
Method Summary
private  void addLine()
          Add a line to the map.
 void countChar(char ch)
          Count a character read (and hope this gets inlined).
 void countChars(char[] chBuf, int off, int len)
          Count an array character's readed
 void popFile()
          Pop a file from the stack.
 void pushFile(java.lang.String fileName)
          Push a file on the stack.
 
Methods inherited from class org.enhydra.xml.xmlc.misc.LineNumberMap
addLine, getLineFromLineNum, getLineFromOffset, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fFileName

private java.lang.String fFileName
Current source file name.


fLineNum

private int fLineNum
Current line-number in the file.


fStreamLineNum

private int fStreamLineNum
Line number in the stream.


fStreamCharOffset

private int fStreamCharOffset
Character offset in the stream.


fPrevWasReturn

private boolean fPrevWasReturn
Was the previous character a return?


fFileStack

private java.util.ArrayList fFileStack
Stack of FileStackEntry objects

Constructor Detail

LineNumberRecorder

public LineNumberRecorder(java.lang.String fileName)
Constructor, setting initial file.


LineNumberRecorder

public LineNumberRecorder()
Constructor with no initial file.

Method Detail

pushFile

public void pushFile(java.lang.String fileName)
Push a file on the stack. Called when an included file is opened.


popFile

public void popFile()
Pop a file from the stack. Called when an included file is closed. Allows for an extra pop to close the originally opened file.


addLine

private void addLine()
Add a line to the map.


countChar

public final void countChar(char ch)
Count a character read (and hope this gets inlined).


countChars

public final void countChars(char[] chBuf,
                             int off,
                             int len)
Count an array character's readed