|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.redfelineninja.util.Token
This class is a companion to the various Java tokenizers. It is an immutable class that initializes itself from the current state of a tokenizer.
It is most tightly intergrated with CommandTokenizer but should work with StreamTokenizer.
CommandTokenizer
,
StreamTokenizer
Field Summary | |
double |
nval
|
java.lang.String |
sval
|
static int |
TT_EOF
|
static int |
TT_EOL
|
static int |
TT_NUMBER
|
static int |
TT_WORD
|
int |
ttype
|
Constructor Summary | |
Token(CommandTokenizer tokenizer)
Create a new Token from a CommandTokenizer. |
|
Token(java.io.StreamTokenizer tokenizer)
Create a new Token from a StreamTokenizer. |
|
Token(java.io.StreamTokenizer tokenizer,
char[] s)
Create a new Token from a StreamTokenizer. |
Method Summary | |
static java.lang.Character |
getCharacter(java.io.StreamTokenizer tok,
char[] quotes)
Try to get a character from the supplied tokenizer. |
static boolean |
getEOF(java.io.StreamTokenizer tok)
Test whether the supplied tokenizer has reached the end of a file. |
static boolean |
getEOL(java.io.StreamTokenizer tok)
Test whether the supplied tokenizer has reached the end of a line. |
static java.lang.Double |
getNumber(java.io.StreamTokenizer tok)
Try to get a number from the supplied tokenizer. |
static java.lang.String |
getString(java.io.StreamTokenizer tok,
char[] quotes)
Try to get a string from the supplied tokenizer. |
static java.lang.String |
getText(java.io.StreamTokenizer tok,
char[] quotes)
Try to get a text token from the supplied tokenizer. |
static java.lang.String |
getWord(java.io.StreamTokenizer tok)
Try to get a word from the supplied tokenizer. |
boolean |
isNumeric()
Test if the Token is numeric. |
boolean |
isString()
Test if the token is a quoted string. |
boolean |
isText()
Test if sval is defined for this token. |
boolean |
isWord()
Test if the token is a single word. |
java.lang.String |
toString()
Convert the current token to printable form. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public final int ttype
public final double nval
public final java.lang.String sval
public static final int TT_EOF
public static final int TT_EOL
public static final int TT_WORD
public static final int TT_NUMBER
Constructor Detail |
public Token(CommandTokenizer tokenizer)
public Token(java.io.StreamTokenizer tokenizer)
public Token(java.io.StreamTokenizer tokenizer, char[] s)
Method Detail |
public java.lang.String toString()
toString
in class java.lang.Object
public final boolean isNumeric()
public final boolean isWord()
public final boolean isString()
public final boolean isText()
public static final java.lang.Double getNumber(java.io.StreamTokenizer tok) throws java.io.IOException
java.io.IOException
public static final java.lang.String getText(java.io.StreamTokenizer tok, char[] quotes) throws java.io.IOException
tok
- the tokenizerquotes
- the characters set in the tokenizer to denote strings
java.io.IOException
public static final java.lang.String getString(java.io.StreamTokenizer tok, char[] quotes) throws java.io.IOException
tok
- the tokenizerquotes
- the characters set in the tokenizer to denote strings
java.io.IOException
public static final java.lang.String getWord(java.io.StreamTokenizer tok) throws java.io.IOException
tok
- the tokenizer
java.io.IOException
public static final java.lang.Character getCharacter(java.io.StreamTokenizer tok, char[] quotes) throws java.io.IOException
tok
- the tokenizerquotes
- the characters set in the tokenizer to denote strings
java.io.IOException
public static final boolean getEOL(java.io.StreamTokenizer tok) throws java.io.IOException
java.io.IOException
StreamTokenizer.eolIsSignificant(boolean)
public static final boolean getEOF(java.io.StreamTokenizer tok) throws java.io.IOException
java.io.IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |