Class graph.ScanWord
All Packages Class Hierarchy This Package Previous Next Index
Class graph.ScanWord
java.lang.Object
|
+----java.io.StreamTokenizer
|
+----graph.ScanWord
- public class ScanWord
- extends StreamTokenizer
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.
- Version:
- 1.5, 1996/07/24 00:19:41
- Author:
- Leigh Brookshaw
-
ERROR
- Token returned when an error is encountered
-
STRING
- Token returned when a string has been found.
-
UNKNOWN
- Token returned when an unknown characters match nothing
-
ScanWord(InputStream)
- Instantiate the class with the parsed input stream.
-
addKeyWord(String, int)
- Add a keyword/token pair.
-
closeStream()
- Close the input stream
-
getKeyValue(String)
- return the matching token given the keyword
-
getNumber(String)
- 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
-
nextWord()
- Read the input stream and return the next token found.
-
resetKeyWords()
- Clear the internal table containing the keyword/token pairs
-
resetWordSyntax()
- Reset the syntax of the parent class
-
setStringChar(char)
- Set the character that delimeters a string.
UNKNOWN
public final static int UNKNOWN
- Token returned when an unknown characters match nothing
ERROR
public final static int ERROR
- Token returned when an error is encountered
STRING
public final static int STRING
- Token returned when a string has been found. A string is defined to be
text between matching quotes " ".
ScanWord
public ScanWord(InputStream in)
- Instantiate the class with the parsed input stream.
- Parameters:
- in - Input stream to read from
addKeyWord
public void addKeyWord(String s,
int i)
- Add a keyword/token pair.
- Parameters:
- s - String contining the keyword
- i - Token to return when the keyword is encountered.
getKeyValue
public int getKeyValue(String s)
- return the matching token given the keyword
- Parameters:
- s - Keyword.
resetKeyWords
public void resetKeyWords()
- Clear the internal table containing the keyword/token pairs
nextWord
public int nextWord()
- Read the input stream and return the next token found.
setStringChar
public void setStringChar(char c)
- Set the character that delimeters a string.
- Parameters:
- c - character to delimeter strings. Default is ".
getNumber
protected int getNumber(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
- Parameters:
- s - String to find number.
resetWordSyntax
protected void resetWordSyntax()
- Reset the syntax of the parent class
closeStream
protected void closeStream()
- Close the input stream
All Packages Class Hierarchy This Package Previous Next Index