|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.adaptx.util.Tokenizer
public class Tokenizer
Splits a String into tokens using a specified set of String delimiters. Delimeters are searched for in the that they appear in the delimiter list. If one delimiter is part of another delimiter, make sure you add them in the proper order for correct behavoir
Field Summary | |
---|---|
static java.lang.String[] |
DEFAULT_DELIMITERS
The set of delimiters to use, if none are specified |
Constructor Summary | |
---|---|
Tokenizer(java.lang.String pattern)
Creates a new Tokenizer using the given String and the default set of delimiters. |
|
Tokenizer(java.lang.String pattern,
java.lang.String[] delimiters)
Creates a new Tokenizer using the given String and the default set of delimiters |
Method Summary | |
---|---|
void |
advance(int offset)
Advances the index of this tokenizer ahead by the given offset |
int |
countTokens()
Counts the number of times nextToken can be called without returning null |
int |
getPosition()
|
boolean |
hasMoreTokens()
Determines if there are any tokens available |
boolean |
hasToken(java.lang.String token)
Determines if the specified token is contained in the token list of this Tokenizer |
boolean |
isDelimiter(java.lang.String token)
Determines if the specified token is a delimiter for this Tokenizer |
java.lang.String |
lookAhead(int offset)
Allows looking ahead for tokens without affecting the token sequence as called by nextToken or previousToken |
java.lang.String |
nextToken()
Retrieves the next available token |
java.lang.String |
previousToken()
Retrieves the previous token |
void |
resetPosition()
Resets the position of the token pointer to the beginning |
void |
setPosition(int position)
Sets the current position of this tokenizer. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String[] DEFAULT_DELIMITERS
Constructor Detail |
---|
public Tokenizer(java.lang.String pattern)
public Tokenizer(java.lang.String pattern, java.lang.String[] delimiters)
Method Detail |
---|
public void advance(int offset)
public int countTokens()
public int getPosition()
public boolean hasMoreTokens()
public boolean hasToken(java.lang.String token)
token
- the String to look for in the token list
public boolean isDelimiter(java.lang.String token)
token
- the String to compare to the delimiters
public java.lang.String lookAhead(int offset)
public java.lang.String nextToken()
public java.lang.String previousToken()
public void resetPosition()
public void setPosition(int position)
position
- the index value to set the current position to.
if position is greater than the number of tokens, the tokenizer
is advanced to the end. If the given position is less than 0,
the tokenizer is positioned at the beginningpublic java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |