|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectpobs.scanner.PTextScanner
A PTextScannerdecorator which returns line and column numbers of a
texts with newline and tab characters.
| Constructor Summary | |
PTextScanner(PScanner scanner)
Creates an instance for the specified scanner. |
|
PTextScanner(PScanner scanner,
int tabStep)
Creates an instance for the specified scanner and tabulator step. |
|
| Method Summary | |
char |
charAt(long index)
Returns the character at the specified location. |
PPosition |
getPosition(long index)
Returns the number of lines and columns between from the start of the input upto the specified index. |
PPosition |
getRelativePosition(long from,
long to)
Returns the number of lines and columns between the from and to indexes. |
long |
length()
Gives the length of this scanners' content. |
java.lang.String |
substring(long beginIndex,
long endIndex)
Returns the part of the input from the beginning upto the ending index locations. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PTextScanner(PScanner scanner)
new PTextScanner(scanner, 8).
scanner - Wrapped scanner instance. null is not allowed.
public PTextScanner(PScanner scanner,
int tabStep)
scanner - Wrapped scanner instance. null is not allowed.tabStep - Tabulator step used to calculate the column number when an
ASCII TAB character occurs. Must be a positive number.
java.lang.IllegalArgumentException - if one of the two conditions at the arguments are violated.| Method Detail |
public char charAt(long index)
throws java.lang.IndexOutOfBoundsException
PScanner
charAt in interface PScannerindex - position of the character to return
java.lang.IndexOutOfBoundsException - when the specified index is either less than zero or equal or
more than the lengthpublic long length()
PScanner
length in interface PScanner
public java.lang.String substring(long beginIndex,
long endIndex)
PScanner
substring in interface PScannerbeginIndex - starting offset from which to extract the substringendIndex - ending offset at which the substring ends
Stringpublic PPosition getPosition(long index)
index - the index upto which is counted
public PPosition getRelativePosition(long from,
long to)
from - the base index from where to start countingto - the index upto which is counted
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||