org.exolab.adaptx.util
public class Tokenizer extends Object
Version: $Revision: 3633 $ $Date: 2003-03-01 02:38:44 -0500 (Sat, 01 Mar 2003) $
Field Summary | |
---|---|
static String[] | DEFAULT_DELIMITERS
The set of delimiters to use, if none are specified
|
Constructor Summary | |
---|---|
Tokenizer(String pattern)
Creates a new Tokenizer using the given String and the
default set of delimiters. | |
Tokenizer(String pattern, 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(String token)
Determines if the specified token is contained in
the token list of this Tokenizer |
boolean | isDelimiter(String token)
Determines if the specified token is a delimiter for
this Tokenizer |
String | lookAhead(int offset)
Allows looking ahead for tokens without affecting the
token sequence as called by nextToken or previousToken
|
String | nextToken()
Retrieves the next available token |
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. |
String | toString() |
Returns: true if there are tokens available, otherwise false
Parameters: token the String to look for in the token list
Returns: true if the String argument is contained in this Tokenizer's token list, otherwise false
Parameters: token the String to compare to the delimiters
Returns: true if the String argument is a delimiter
Returns: the next available token or null if there are none
Returns: the previous token or null if a previous token is not available
Parameters: 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 beginning