org.mbari.siam.moos.utils.chart.graph
Class ScanString

java.lang.Object
  extended by org.mbari.siam.moos.utils.chart.graph.ScanString
Direct Known Subclasses:
ParseFunction

public class ScanString
extends java.lang.Object

This class is similar to the ScanWord class, except it scans a string for keywords rather than an input stream.

Version:
$Revision: 1.1 $, $Date: 2008/11/04 22:17:54 $
Author:
Leigh Brookshaw

Field Summary
static int EOS
          flag the End of String
static int ERROR
          Flag an error
static int NUMBER
          Flag a Number
 double nval
           
 java.lang.String sval
           
static int UNKNOWN
          flag an unknown token
 
Constructor Summary
ScanString()
          Instantiate the Class
ScanString(java.lang.String s)
          Instantaite the Class
 
Method Summary
 void addKeyWord(java.lang.String s, int i)
          Add a keyword/token pair to the table of keywords to scan for.
 int getKeyValue(java.lang.String s)
           
 int nextWord()
          Process the string and return the next token found.
 void resetKeyWords()
          Clear the table containing the keyword/token pairs
 void setString(java.lang.String s)
          Set the string to be scanned
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN

public static final int UNKNOWN
flag an unknown token

See Also:
Constant Field Values

ERROR

public static final int ERROR
Flag an error

See Also:
Constant Field Values

NUMBER

public static final int NUMBER
Flag a Number

See Also:
Constant Field Values

EOS

public static final int EOS
flag the End of String

See Also:
Constant Field Values

sval

public java.lang.String sval

nval

public double nval
Constructor Detail

ScanString

public ScanString()
Instantiate the Class


ScanString

public ScanString(java.lang.String s)
Instantaite the Class

Parameters:
s - String to scan for tokens
Method Detail

setString

public void setString(java.lang.String s)
Set the string to be scanned

Parameters:
s - String

addKeyWord

public void addKeyWord(java.lang.String s,
                       int i)
Add a keyword/token pair to the table of keywords to scan for.

Parameters:
s - keyword string to scan for
i - token to return when the keyword is found

getKeyValue

public int getKeyValue(java.lang.String s)
Parameters:
s - keyword string
Returns:
the token corresponding to the keyword

resetKeyWords

public void resetKeyWords()
Clear the table containing the keyword/token pairs


nextWord

public int nextWord()
Process the string and return the next token found.

Returns:
token found


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.