|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--tracer.expression.Expression
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.
| Field Summary | |
ExprNode |
enode
The root expression node generated by parsing the expression string. |
java.util.Vector |
symQueue
The symbol queue created for operator-precedence parsing. |
java.util.Stack |
symStack
The operator, expression node stack created for operator-precedence parsing. |
| Constructor Summary | |
Expression()
Construct an empty expression. |
|
Expression(java.lang.String expr)
Construct an expression by a string representation. |
|
| Method Summary | |
boolean |
appendSymbol(Symbol sym)
Append a symbol to the end of an expression. |
double |
eval()
Evaluate the expression. |
java.lang.String |
getErrMsg()
Return a string indicates where the parsing error occurs. |
static Symbol |
nextSymbol(java.io.StreamTokenizer st)
Fetch the next symbol from the input expression string. |
(package private) void |
parse(java.io.StreamTokenizer st)
Parse the input expression string, returns the root expression node of the operator-precedence parse tree. |
static Symbol |
toSymbol(java.lang.String s)
Convert a string to a symbol. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
public ExprNode enode
public java.util.Vector symQueue
public java.util.Stack symStack
| Constructor Detail |
public Expression()
public Expression(java.lang.String expr)
throws ExpressionParseException
| Method Detail |
public boolean appendSymbol(Symbol sym)
throws ExpressionParseException
void parse(java.io.StreamTokenizer st)
throws java.io.IOException,
ExpressionParseException
public double eval()
throws ExpressionEvalException
public static Symbol toSymbol(java.lang.String s)
public static Symbol nextSymbol(java.io.StreamTokenizer st)
throws java.io.IOException,
ExpressionParseException
public java.lang.String getErrMsg()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||