|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--java.util.StringTokenizer
|
+--AdaptedStringTokenizer
The AdaptedStringTokenizer class extends StringTokenizer
to allow the user to use strings as tokens. The StringTokenizer takes a
string and a set of tokens and returns a set of strings
representing the original string divided according the the tokens. For example, a common set of tokens
is the whitespace characters. The string "the quick brown fox" would tokenize to: "the", "quick",
"brown", "fox". When the next token is called for any preceeding delimiters are skipped then from
the first character that isn't a delimiter characters are added to the out string until another token
is hit.
| Field Summary | |
boolean |
allowWhitespace
boolean flag representing whether or not whitespace should be included in the strings that are returned |
protected int |
currentIndex
the current position of the StringTokenizer in the sting being processed |
protected int |
maxIndex
the maximum index of the string being processed |
boolean |
returnTokens
boolean flag representing whether or not tokens should be included in the strings that are returned |
protected java.lang.String[] |
tokens
the delimiters that determine where the string is divided |
protected java.lang.String |
tokenString
the string which is being tokenized |
| Constructor Summary | |
AdaptedStringTokenizer(java.lang.String s,
java.lang.String[] t)
Constructs a tokenization of the given string. |
|
AdaptedStringTokenizer(java.lang.String s,
java.lang.String[] t,
boolean whitespace)
Constructs a tokenization of the given string. |
|
AdaptedStringTokenizer(java.lang.String s,
java.lang.String[] t,
boolean whitespace,
boolean tok)
Constructs a tokenization of the given string. |
|
| Method Summary | |
boolean |
hasMoreTokens()
|
java.lang.String |
nextToken()
There are several different cases for what can be considered tokens depending on the states of different flags. |
java.lang.String |
nextToken(java.lang.String[] t)
Operates the same as nextToken() but before the processing is begun the set of delimiters is replaced. |
protected void |
skipDelimiters()
Internal method to skip over delimiters in the string being tokenized until a non-delimiter is reached. |
protected void |
skipWhitespace()
Internal method to skip over whitespace (as defined in Charater.isWhitespace) characters in the string being tokenized until a non-whitespace character is reached. |
protected boolean |
startsWithToken()
Internal method representing the state of the current substring left from the tokenization to this point. |
| Methods inherited from class java.util.StringTokenizer |
countTokens,
hasMoreElements,
nextElement,
nextToken |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public boolean allowWhitespace
public boolean returnTokens
protected int currentIndex
protected int maxIndex
protected java.lang.String tokenString
protected java.lang.String[] tokens
| Constructor Detail |
public AdaptedStringTokenizer(java.lang.String s,
java.lang.String[] t)
s - the string to be toknizedt - the delimiters that are to be used to separate the tokens
public AdaptedStringTokenizer(java.lang.String s,
java.lang.String[] t,
boolean whitespace)
s - the string to be toknizedt - the delimiters that are to be used to separate the tokenswhitespace - flag indicating whether or not to include whitespace in the returned tokens
public AdaptedStringTokenizer(java.lang.String s,
java.lang.String[] t,
boolean whitespace,
boolean tok)
s - the string to be toknizedt - the delimiters that are to be used to separate the tokenswhitespace - flag indicating whether or not to include whitespace in the returned tokenstok - flag indicating whether or not the delimiters should be returned as tokens| Method Detail |
protected void skipDelimiters()
protected void skipWhitespace()
protected boolean startsWithToken()
public boolean hasMoreTokens()
public java.lang.String nextToken()
public java.lang.String nextToken(java.lang.String[] t)
t - the new set of delimiters
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||