|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjfun.parsec.DefaultPositionMap
public class DefaultPositionMap
This default implementation of PositionMap.
This class internally keeps a cache of the positions of all the line break characters scanned so far, therefore repeated position lookup can be done in amortized log(n) time.
Constructor Summary | |
---|---|
DefaultPositionMap(java.lang.CharSequence src,
int lno,
int cno)
Create a DefaultPositionMap object. |
|
DefaultPositionMap(java.lang.CharSequence src,
int lno,
int cno,
char line_break)
Create a DefaultPositionMap object. |
Method Summary | |
---|---|
Pos |
getPos(int n)
Get the line/column number of a position identified by an offset number. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultPositionMap(java.lang.CharSequence src, int lno, int cno, char line_break)
src
- the source.lno
- the starting line number.cno
- the starting column number.line_break
- the line break character.public DefaultPositionMap(java.lang.CharSequence src, int lno, int cno)
src
- the source.lno
- the starting line number.cno
- the starting column number.Method Detail |
---|
public Pos getPos(int n)
PositionMap
getPos
in interface PositionMap
n
- the offset in the source, starting from 0.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |