Class expression.Expression
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class expression.Expression

java.lang.Object
   |
   +----expression.Expression

public class Expression
extends Object
The class representing an expression. Legal expression symbols include: all double precision numbers; arithmetic operators including '+', '-', '*', '/' and '^'; left bracket '(' and right bracket ')'; Three variables including 'x' (or 'X'), 'y' (or 'Y') and 'z' (or 'Z'); And many unary functions such as 'COS', 'SIN', etc.

Variable Index

 o enode
The root expression node generated by parsing the expression string.
 o symQueue
The symbol queue created for operator-precedence parsing.
 o symStack
The operator, expression node stack created for operator-precedence parsing.

Constructor Index

 o Expression()
Construct an empty expression.
 o Expression(String)
Construct an expression by a string representation.

Method Index

 o appendSymbol(Symbol)
Append a symbol to the end of an expression.
 o eval()
Evaluate the expression.
 o getErrMsg()
Return a string indicates where the parsing error occurs.
 o nextSymbol(StreamTokenizer)
Fetch the next symbol from the input expression string.
 o toSymbol(String)
Convert a string to a symbol.

Variables

 o enode
  public ExprNode enode
The root expression node generated by parsing the expression string.
 o symQueue
  public Vector symQueue
The symbol queue created for operator-precedence parsing.
 o symStack
  public Stack symStack
The operator, expression node stack created for operator-precedence parsing.

Constructors

 o Expression
  public Expression()
Construct an empty expression.
 o Expression
  public Expression(String expr) throws ExpressionParseException
Construct an expression by a string representation.

Methods

 o appendSymbol
  public boolean appendSymbol(Symbol sym) throws ExpressionParseException
Append a symbol to the end of an expression. Return true if the whole expression is reduced into a single expression node, or the expression is empty.
 o eval
  public double eval() throws ExpressionEvalException
Evaluate the expression.
 o toSymbol
  public static Symbol toSymbol(String s)
Convert a string to a symbol.
 o nextSymbol
  public static Symbol nextSymbol(StreamTokenizer st) throws IOException, ExpressionParseException
Fetch the next symbol from the input expression string.
 o getErrMsg
  public String getErrMsg()
Return a string indicates where the parsing error occurs.

All Packages  Class Hierarchy  This Package  Previous  Next  Index