|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.unkrig.commons.text.scanner.AbstractScanner<TT>
TT - Enumerates the scanner-specific token typespublic abstract class AbstractScanner<TT extends java.lang.Enum<TT>>
A scanner that produces AbstractScanner.Tokens.
| Nested Class Summary | |
|---|---|
static class |
AbstractScanner.Token<TT extends java.lang.Enum<TT>>
Representation of a scanned token. |
| Field Summary | |
|---|---|
protected java.lang.CharSequence |
cs
The string currently being scanned; typically one line from an input document. |
protected int |
offset
The position within cs of the next token to be scanned. |
protected int |
previousTokenOffset
The position within cs of the previously scanned token. |
| Constructor Summary | |
|---|---|
AbstractScanner()
|
|
| Method Summary | |
|---|---|
int |
getOffset()
|
int |
getPreviousTokenOffset()
|
abstract AbstractScanner.Token<TT> |
produce()
Before setInput(CharSequence) is called, this method returns null. |
AbstractScanner<TT> |
setInput(java.lang.CharSequence cs)
|
java.lang.String |
toString()
Returns a human-readable text which describes the origin of the previously produced element, e.g. file name, line number and column number |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.CharSequence cs
protected int offset
cs of the next token to be scanned.
protected int previousTokenOffset
cs of the previously scanned token.
| Constructor Detail |
|---|
public AbstractScanner()
| Method Detail |
|---|
public AbstractScanner<TT> setInput(java.lang.CharSequence cs)
setInput in interface StringScanner<TT extends java.lang.Enum<TT>>cs - The CharSequence from which following calls to ProducerWhichThrows.produce() will scan tokens
@Nullable
public abstract AbstractScanner.Token<TT> produce()
throws ScanException
setInput(CharSequence) is called, this method returns null. After setInput(CharSequence) was called, this method breaks the input char character sequence up into tokens and
returns them one by one. When the input char sequence is exhausted, null is returned until setInput(CharSequence) is called again.
produce in interface ProducerWhichThrows<AbstractScanner.Token<TT extends java.lang.Enum<TT>>,ScanException>ScanExceptionpublic int getOffset()
getOffset in interface StringScanner<TT extends java.lang.Enum<TT>>StringScanner.setInput(CharSequence) where the previously
scanned token ends, or 0 after the call to StringScanner.setInput(CharSequence) and before the first
call to ProducerWhichThrows.produce()public int getPreviousTokenOffset()
getPreviousTokenOffset in interface StringScanner<TT extends java.lang.Enum<TT>>StringScanner.setInput(CharSequence) where the previously
scanned token begins, or -1 after the call to StringScanner.setInput(CharSequence) and before the first
call to ProducerWhichThrows.produce()public java.lang.String toString()
ProducerWhichThrows
toString in interface ProducerWhichThrows<AbstractScanner.Token<TT extends java.lang.Enum<TT>>,ScanException>toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||