Class Parser
java.lang.Object
|
+----java.lang.Thread
|
+----Parser
- public abstract class Parser
- extends Thread
Class definition for an apstract parser class.
- Version:
- $Revision: 1.4 $, $Date: 2000/10/12 17:38:13 $
- Author:
- John Cavanaugh
-
bytesRead
- An approximate count of bytes read from the input stream.
-
cancelled
- A flag indicating whether the operation has been cancelled.
-
eof
- A flag that is set to true when the tokenizer
reaches the end of the input file.
-
FATAL_ERROR
-
-
fatalErrList
- A list of the fatal errors that were encountered.
-
net
- The network to receive the configuration.
-
reader
- A buffered input stream reader for the input file.
-
tokenizer
- A tokenizer to break the input stream into fields.
-
WARNING_ERROR
-
-
warningErrList
- A list of the warnings that were encountered.
-
Parser(InputStreamReader, Network)
- Constructs a parser.
-
cancel()
- Cancel the parse operation.
-
flagError(int, String)
- Add an error message to the list
-
getBytesRead()
- Get the current location in the input stream.
-
getEOF()
- Get an EOF indication.
-
getFatalErrors()
- Get the list of fatal errors.
-
getNextRecord()
- Get the next line from the input stream.
-
getWarnings()
- Get the list of warnings.
-
isCancelled()
- Check whether the operation has been cancelled.
-
run()
- Main line code -- must be provided by subclass.
FATAL_ERROR
protected static final int FATAL_ERROR
WARNING_ERROR
protected static final int WARNING_ERROR
reader
Reader reader
- A buffered input stream reader for the input file.
tokenizer
StreamTokenizer tokenizer
- A tokenizer to break the input stream into fields.
net
protected Network net
- The network to receive the configuration.
cancelled
protected Boolean cancelled
- A flag indicating whether the operation has been cancelled.
fatalErrList
protected Vector fatalErrList
- A list of the fatal errors that were encountered.
warningErrList
protected Vector warningErrList
- A list of the warnings that were encountered.
bytesRead
long bytesRead
- An approximate count of bytes read from the input stream.
eof
boolean eof
- A flag that is set to true when the tokenizer
reaches the end of the input file.
Parser
public Parser(InputStreamReader reader,
Network net)
- Constructs a parser.
getBytesRead
public long getBytesRead()
- Get the current location in the input stream.
- Returns:
- the number of bytes read from the input stream.
getEOF
public boolean getEOF()
- Get an EOF indication.
- Returns:
- true if the tokenizer has reached the end of
the input file; false otherwise.
getFatalErrors
public Vector getFatalErrors()
- Get the list of fatal errors.
- Returns:
- a Vector of fatal error messages.
getWarnings
public Vector getWarnings()
- Get the list of warnings.
- Returns:
- a Vector of warning error messages.
isCancelled
public boolean isCancelled()
- Check whether the operation has been cancelled.
- Returns:
- true if the parse operation has been cancelled;
false otherwise.
cancel
public void cancel()
- Cancel the parse operation.
flagError
protected void flagError(int severity,
String msg)
- Add an error message to the list
- Parameters:
- severity - the severity of the error (fatal
or warning).
- msg - the error message.
getNextRecord
protected String[] getNextRecord()
- Get the next line from the input stream.
- Returns:
- an array of strings, with one input field in
each string.
run
public abstract void run()
- Main line code -- must be provided by subclass.
- Overrides:
- run in class Thread