|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.io.StreamTokenizer
org.mbari.siam.moos.utils.chart.graph.ScanWord
public class 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 |
static int |
STRING
Token returned when a string has been found. |
static int |
UNKNOWN
Token returned when an unknown characters match nothing |
| Fields inherited from class java.io.StreamTokenizer |
|---|
nval, sval, TT_EOF, TT_EOL, 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, resetSyntax, slashSlashComments, slashStarComments, toString, whitespaceChars, wordChars |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int UNKNOWN
public static final int ERROR
public static final int STRING
| 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: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||