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 ERROR
-  Token returned when an error is encountered
  
-   STRING STRING
-  Token returned when a string has been found.
  
-   UNKNOWN UNKNOWN
-  Token returned when an unknown characters match nothing
   
  -   ScanWord(InputStream) ScanWord(InputStream)
-  Instantiate the class with the parsed input stream.
   
  -   addKeyWord(String, int) addKeyWord(String, int)
-  Add a keyword/token pair.
  
-   closeStream() closeStream()
-   Close the input stream
  
-   getKeyValue(String) getKeyValue(String)
-    return the matching token given the keyword
  
-   getNumber(String) 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() nextWord()
-   Read the input stream and return the next token found.
  
-   resetKeyWords() resetKeyWords()
-    Clear the internal table containing the keyword/token pairs
  
-   resetWordSyntax() resetWordSyntax()
-    Reset the syntax of the parent class
  
-   setStringChar(char) setStringChar(char)
-  Set the character that delimeters a string.
   
 UNKNOWN
UNKNOWN
  public final static int UNKNOWN
  -  Token returned when an unknown characters match nothing
 ERROR
ERROR
  public final static int ERROR
  -  Token returned when an error is encountered
 STRING
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
ScanWord
  public ScanWord(InputStream in)
  -  Instantiate the class with the parsed input stream.
  
    -  Parameters:
    
-  in - Input stream to read from
  
 
   
 addKeyWord
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
getKeyValue
  public int getKeyValue(String s)
  -  return the matching token given the keyword
  
    -  Parameters:
    
-  s - Keyword.
  
 
 resetKeyWords
resetKeyWords
  public void resetKeyWords()
  -  Clear the internal table containing the keyword/token pairs
 nextWord
nextWord
  public int nextWord()
  -  Read the input stream and return the next token found.
 setStringChar
setStringChar
  public void setStringChar(char c)
  -  Set the character that delimeters a string.
  
    -  Parameters:
    
-  c - character to delimeter strings. Default is ".
  
 
 getNumber
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
resetWordSyntax
  protected void resetWordSyntax()
  -  Reset the syntax of the parent class
 closeStream
closeStream
  protected void closeStream()
  -  Close the input stream
All Packages  Class Hierarchy  This Package  Previous  Next  Index