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

Variable Index

 o bytesRead
An approximate count of bytes read from the input stream.
 o cancelled
A flag indicating whether the operation has been cancelled.
 o eof
A flag that is set to true when the tokenizer reaches the end of the input file.
 o FATAL_ERROR
 o fatalErrList
A list of the fatal errors that were encountered.
 o net
The network to receive the configuration.
 o reader
A buffered input stream reader for the input file.
 o tokenizer
A tokenizer to break the input stream into fields.
 o WARNING_ERROR
 o warningErrList
A list of the warnings that were encountered.

Constructor Index

 o Parser(InputStreamReader, Network)
Constructs a parser.

Method Index

 o cancel()
Cancel the parse operation.
 o flagError(int, String)
Add an error message to the list
 o getBytesRead()
Get the current location in the input stream.
 o getEOF()
Get an EOF indication.
 o getFatalErrors()
Get the list of fatal errors.
 o getNextRecord()
Get the next line from the input stream.
 o getWarnings()
Get the list of warnings.
 o isCancelled()
Check whether the operation has been cancelled.
 o run()
Main line code -- must be provided by subclass.

Variables

 o FATAL_ERROR
 protected static final int FATAL_ERROR
 o WARNING_ERROR
 protected static final int WARNING_ERROR
 o reader
 Reader reader
A buffered input stream reader for the input file.

 o tokenizer
 StreamTokenizer tokenizer
A tokenizer to break the input stream into fields.

 o net
 protected Network net
The network to receive the configuration.

 o cancelled
 protected Boolean cancelled
A flag indicating whether the operation has been cancelled.

 o fatalErrList
 protected Vector fatalErrList
A list of the fatal errors that were encountered.

 o warningErrList
 protected Vector warningErrList
A list of the warnings that were encountered.

 o bytesRead
 long bytesRead
An approximate count of bytes read from the input stream.

 o eof
 boolean eof
A flag that is set to true when the tokenizer reaches the end of the input file.

Constructors

 o Parser
 public Parser(InputStreamReader reader,
               Network net)
Constructs a parser.

Methods

 o getBytesRead
 public long getBytesRead()
Get the current location in the input stream.

Returns:
the number of bytes read from the input stream.
 o getEOF
 public boolean getEOF()
Get an EOF indication.

Returns:
true if the tokenizer has reached the end of the input file; false otherwise.
 o getFatalErrors
 public Vector getFatalErrors()
Get the list of fatal errors.

Returns:
a Vector of fatal error messages.
 o getWarnings
 public Vector getWarnings()
Get the list of warnings.

Returns:
a Vector of warning error messages.
 o isCancelled
 public boolean isCancelled()
Check whether the operation has been cancelled.

Returns:
true if the parse operation has been cancelled; false otherwise.
 o cancel
 public void cancel()
Cancel the parse operation.

 o 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.
 o getNextRecord
 protected String[] getNextRecord()
Get the next line from the input stream.

Returns:
an array of strings, with one input field in each string.
 o run
 public abstract void run()
Main line code -- must be provided by subclass.

Overrides:
run in class Thread