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.
-
enode
- The root expression node generated by parsing the expression string.
-
symQueue
- The symbol queue created for operator-precedence parsing.
-
symStack
- The operator, expression node stack created for operator-precedence parsing.
-
Expression()
- Construct an empty expression.
-
Expression(String)
- Construct an expression by a string representation.
-
appendSymbol(Symbol)
- Append a symbol to the end of an expression.
-
eval()
- Evaluate the expression.
-
getErrMsg()
- Return a string indicates where the parsing error occurs.
-
nextSymbol(StreamTokenizer)
- Fetch the next symbol from the input expression string.
-
toSymbol(String)
- Convert a string to a symbol.
enode
public ExprNode enode
- The root expression node generated by parsing the expression string.
symQueue
public Vector symQueue
- The symbol queue created for operator-precedence parsing.
symStack
public Stack symStack
- The operator, expression node stack created for operator-precedence parsing.
Expression
public Expression()
- Construct an empty expression.
Expression
public Expression(String expr) throws ExpressionParseException
- Construct an expression by a string representation.
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.
eval
public double eval() throws ExpressionEvalException
- Evaluate the expression.
toSymbol
public static Symbol toSymbol(String s)
- Convert a string to a symbol.
nextSymbol
public static Symbol nextSymbol(StreamTokenizer st) throws IOException, ExpressionParseException
- Fetch the next symbol from the input expression string.
getErrMsg
public String getErrMsg()
- Return a string indicates where the parsing error occurs.
All Packages Class Hierarchy This Package Previous Next Index