|
J avolution v3.7 (J2SE 1.5+) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.text.ParsePosition
javolution.lang.TextFormat.Cursor
public static class TextFormat.Cursor
This class represents a parsing cursor.
| Method Summary | |
|---|---|
int |
getIndex()
Returns this cursor index. |
boolean |
hasNext(java.lang.CharSequence csq)
Indicates if this cursor has not yet reached the end of the specified character sequence. |
void |
increment()
Increments the cursor index by one. |
void |
increment(int i)
Increments the cursor index by the specified value. |
static TextFormat.Cursor |
newInstance()
Returns a new cursor instance (possibly recycled). |
char |
next(java.lang.CharSequence csq)
Returns the next character at the cursor position in the specified character sequence and increments the cursor position by one. |
void |
recycle()
Recycles this cursor for reuse. |
void |
setIndex(int i)
Sets the cursor index. |
boolean |
skip(char c,
java.lang.CharSequence csq)
Moves this cursor forward until it points to a character different from the character specified. |
boolean |
skip(CharSet charSet,
java.lang.CharSequence csq)
Moves this cursor forward until it points to a character different from any of the character in the specified set. |
| Methods inherited from class java.text.ParsePosition |
|---|
equals, getErrorIndex, hashCode, setErrorIndex, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static TextFormat.Cursor newInstance()
0.public final int getIndex()
getIndex in class java.text.ParsePositionpublic final void setIndex(int i)
setIndex in class java.text.ParsePositioni - the index of the next character to parse.public final boolean hasNext(java.lang.CharSequence csq)
csq - the character sequence iterated by this cursor.
this.getIndex() < csq.length()public final char next(java.lang.CharSequence csq)
csq - the character sequence iterated by this cursor.
java.lang.IndexOutOfBoundsException - if (this.getIndex() < 0)
|| (this.getIndex(() >= csq.length())
public final boolean skip(char c,
java.lang.CharSequence csq)
c - the character to skip.csq - the character sequence iterated by this cursor.
true if this cursor points to a character
different from the ones specified; false
otherwise (e.g. end of sequence reached).
public final boolean skip(CharSet charSet,
java.lang.CharSequence csq)
// Reads numbers separated by tabulations or spaces.
FastTable<Integer> numbers = new FastTable<Integer>();
while (cursor.skip(CharSet.SPACE_OR_TAB, csq)) {
numbers.add(TypeFormat.parseInt(csq, cursor));
}
charSet - the character to skip.csq - the character sequence iterated by this cursor.
true if this cursor points to a character
different from the ones specified; false
otherwise (e.g. end of sequence reached).public final void increment()
public final void increment(int i)
i - the increment value.public final void recycle()
|
J avolution v3.7 (J2SE 1.5+) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||