com.jstatcom.parser
Class CalcEngine

java.lang.Object
  extended by com.jstatcom.parser.CalcEngine
All Implemented Interfaces:
CalcEngineConstants

public class CalcEngine
extends java.lang.Object
implements CalcEngineConstants


Field Summary
 Token jj_nt
           
 boolean lookingAhead
           
 Token token
           
 CalcEngineTokenManager token_source
           
 
Fields inherited from interface com.jstatcom.parser.CalcEngineConstants
CONSTANT, DEFAULT, DIGIT, DIVIDE, EOF, EOFEXP, EXP, FLOAT, FUNCNAME, INTEGER, LETTER, LHS, MINUS, MULTIPLY, PLUS, ROWAPPEND, tokenImage, VAR
 
Constructor Summary
CalcEngine()
          Default constructor.
CalcEngine(CalcEngineTokenManager tm)
           
CalcEngine(java.io.InputStream stream)
           
CalcEngine(java.io.InputStream stream, java.lang.String encoding)
           
CalcEngine(java.io.Reader stream)
           
 
Method Summary
 void clearVariableMap()
          Deletes all variables from the variableMap.
 void disable_tracing()
           
 void element()
           
 void enable_tracing()
           
 void equation()
          Expression of the form ()?
 void exp()
           
 void function()
           
 ParseException generateParseException()
           
 Token getNextToken()
           
 java.lang.String getOutput()
          Retrieves the contents of the output buffer of the last parser run.
 Token getToken(int index)
           
 double[] getVariable(java.lang.String variableName)
          Retrieves the underlying data for a variableName.
 java.lang.String[] getVariableNames()
          Retrieves all keys that represent the variable names.
static void main(java.lang.String[] args)
           
 void parseString(java.lang.String inputString)
          Reinitializes engine and parses an input String.
 void putVariable(java.lang.String keyName, double[] dataArray)
          Define the variables that can be used during the parsing.
 void ReInit(CalcEngineTokenManager tm)
           
 void ReInit(java.io.InputStream stream)
           
 void ReInit(java.io.InputStream stream, java.lang.String encoding)
           
 void ReInit(java.io.Reader stream)
           
 void sum()
           
 void term()
           
 int toeval()
           
 void unary()
           
 void variable()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

token_source

public CalcEngineTokenManager token_source

token

public Token token

jj_nt

public Token jj_nt

lookingAhead

public boolean lookingAhead
Constructor Detail

CalcEngine

public CalcEngine()
Default constructor.


CalcEngine

public CalcEngine(java.io.InputStream stream)

CalcEngine

public CalcEngine(java.io.InputStream stream,
                  java.lang.String encoding)

CalcEngine

public CalcEngine(java.io.Reader stream)

CalcEngine

public CalcEngine(CalcEngineTokenManager tm)
Method Detail

main

public static void main(java.lang.String[] args)

clearVariableMap

public void clearVariableMap()
Deletes all variables from the variableMap.


putVariable

public void putVariable(java.lang.String keyName,
                        double[] dataArray)
Define the variables that can be used during the parsing. The dataArray is copied before it is put into the variableMap.

Parameters:
keyName - name of the variable
dataArray - is a (T x 1) array with the data
Throws:
java.lang.IllegalArgumentException - if (JSCConstants.isValidName(keyName) != null || dataArray == null)

getVariableNames

public java.lang.String[] getVariableNames()
Retrieves all keys that represent the variable names.

Returns:
String[] containing the keys

getVariable

public double[] getVariable(java.lang.String variableName)
Retrieves the underlying data for a variableName.

Parameters:
variableName - the name of the variable
Returns:
double[] the data

getOutput

public java.lang.String getOutput()
Retrieves the contents of the output buffer of the last parser run.

Returns:
String the contents of the output buffer

parseString

public void parseString(java.lang.String inputString)
                 throws ParseException,
                        TokenMgrError
Reinitializes engine and parses an input String.

Parameters:
inputString - the String to parse
Throws:
ParseException - if parsing failed, contains error description
TokenMgrError - if tokenizing failed, contains error description

toeval

public final int toeval()
                 throws ParseException
Throws:
ParseException

equation

public final void equation()
                    throws ParseException
Expression of the form ()? sum()

Throws:
ParseException

sum

public final void sum()
               throws ParseException
Throws:
ParseException

term

public final void term()
                throws ParseException
Throws:
ParseException

exp

public final void exp()
               throws ParseException
Throws:
ParseException

unary

public final void unary()
                 throws ParseException
Throws:
ParseException

element

public final void element()
                   throws ParseException
Throws:
ParseException

variable

public final void variable()
                    throws ParseException
Throws:
ParseException

function

public final void function()
                    throws ParseException
Throws:
ParseException

ReInit

public void ReInit(java.io.InputStream stream)

ReInit

public void ReInit(java.io.InputStream stream,
                   java.lang.String encoding)

ReInit

public void ReInit(java.io.Reader stream)

ReInit

public void ReInit(CalcEngineTokenManager tm)

getNextToken

public final Token getNextToken()

getToken

public final Token getToken(int index)

generateParseException

public ParseException generateParseException()

enable_tracing

public final void enable_tracing()

disable_tracing

public final void disable_tracing()