public class DefaultPositionMap extends java.lang.Object implements PositionMap, java.io.Serializable
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 and Description |
|---|
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.
|
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.public Pos getPos(int n)
PositionMapgetPos in interface PositionMapn - the offset in the source, starting from 0.