|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.io.StreamTokenizer
|
+--org.PingOO.DLAI.lib.graph.ScanWord
This class extends the StreamTokenizer class. It allows words to be defined and recognised and returned as a token. The TT_NUMBER token of the StreamTokenizer is also modified so that scientific notation is recognised.
| Field Summary | |
static int |
ERROR
Token returned when an error is encountered |
private java.io.InputStream |
is
Private Variables |
private java.util.Hashtable |
kwords
|
static int |
STRING
Token returned when a string has been found. |
private char |
StringChar
|
static int |
UNKNOWN
Token returned when an unknown characters match nothing |
| Fields inherited from class java.io.StreamTokenizer |
buf,
CT_ALPHA,
CT_COMMENT,
CT_DIGIT,
CT_QUOTE,
CT_WHITESPACE,
ctype,
eolIsSignificantP,
forceLower,
input,
LINENO,
nval,
peekc,
pushedBack,
reader,
slashSlashCommentsP,
slashStarCommentsP,
sval,
TT_EOF,
TT_EOL,
TT_NOTHING,
TT_NUMBER,
TT_WORD,
ttype |
| Constructor Summary | |
ScanWord(java.io.InputStream in)
Instantiate the class with the parsed input stream. |
|
| Method Summary | |
void |
addKeyWord(java.lang.String s,
int i)
Add a keyword/token pair. |
protected void |
closeStream()
Close the input stream |
int |
getKeyValue(java.lang.String s)
return the matching token given the keyword |
protected int |
getNumber(java.lang.String s)
Check to see if the returned word is a number The native StreamTokenizer number method does not work for scientific notation so we us the Double class doubleValue() method |
int |
nextWord()
Read the input stream and return the next token found. |
void |
resetKeyWords()
Clear the internal table containing the keyword/token pairs |
protected void |
resetWordSyntax()
Reset the syntax of the parent class |
void |
setStringChar(char c)
Set the character that delimeters a string. |
| Methods inherited from class java.io.StreamTokenizer |
commentChar,
eolIsSignificant,
lineno,
lowerCaseMode,
nextToken,
ordinaryChar,
ordinaryChars,
parseNumbers,
pushBack,
quoteChar,
read,
resetSyntax,
slashSlashComments,
slashStarComments,
toString,
whitespaceChars,
wordChars |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
public static final int UNKNOWN
public static final int ERROR
public static final int STRING
private java.io.InputStream is
private java.util.Hashtable kwords
private char StringChar
| Constructor Detail |
public ScanWord(java.io.InputStream in)
in - Input stream to read from| Method Detail |
public void addKeyWord(java.lang.String s,
int i)
s - String contining the keywordi - Token to return when the keyword is encountered.public int getKeyValue(java.lang.String s)
s - Keyword.public void resetKeyWords()
public int nextWord()
public void setStringChar(char c)
c - character to delimeter strings. Default is ".protected int getNumber(java.lang.String s)
s - String to find number.protected void resetWordSyntax()
protected void closeStream()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||