Methods Summary |
---|
public int | countTokens()
int n = 0;
int tmpCur = cur;
cur = 0;
while (cur < length) {
skipDelimiters();
if (cur < length) {
n++;
}
skipToken();
}
cur = tmpCur;
return n;
|
boolean | curIsDelimiter()
char c = data.charAt(cur);
for (int i = 0; i < del.length; i++) {
if (c == del[i]) {
return true;
}
}
return false;
|
public boolean | hasMoreTokens()
return cur < length;
|
public java.lang.String | nextToken()
if (!hasMoreTokens()) {
return null;
}
// Now, build the new token.
int s = cur;
cur++;
skipToken();
int e = cur;
// Skip all characters, starting at the current position, which
// match one of the delimiters.
skipDelimiters();
return data.substring(s, e);
|
void | skipDelimiters()Moves the current position to the first next character which is
a delimiter.
while (cur < length && curIsDelimiter()) {
cur++;
}
|
void | skipToken()Moves the current position to the first next character which is
not a delimiter.
while (cur < length && !curIsDelimiter()) {
cur++;
}
|