|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.singularsys.jep.walkers.PostfixTreeWalker
com.singularsys.jep.walkers.PostfixEvaluator
public class PostfixEvaluator
Evaluation component that avoids excessive use of the stack for large expressions. Instead of using recursion to traverse the expression tree, traversal is based on the PostfixTreeWalker.
Field Summary | |
---|---|
protected java.util.Stack<java.lang.Object> |
stack
|
Constructor Summary | |
---|---|
PostfixEvaluator()
|
Method Summary | |
---|---|
java.lang.Object |
eval(Node node)
Evaluates a sub expression. |
java.lang.Object |
evaluate(Node node)
Evaluates a node and returns and object with the value of the node. |
JepComponent |
getLightWeightInstance()
Return new PostfixEvaluator |
void |
init(Jep jep)
Initialize the component. |
protected boolean |
supressExaminingChildren(Node child)
Whether to examine the children of this nodes. |
protected void |
visit(ASTConstant node,
int nchildren,
int depth)
|
protected void |
visit(ASTFunNode node,
int nchildren,
int depth)
|
protected void |
visit(ASTOpNode node,
int nchildren,
int depth)
|
protected void |
visit(ASTVarNode node,
int nchildren,
int depth)
|
Methods inherited from class com.singularsys.jep.walkers.PostfixTreeWalker |
---|
walk, walkSubEquations |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient java.util.Stack<java.lang.Object> stack
Constructor Detail |
---|
public PostfixEvaluator()
Method Detail |
---|
public java.lang.Object evaluate(Node node) throws EvaluationException
Evaluator
evaluate
in interface Evaluator
EvaluationException
protected void visit(ASTFunNode node, int nchildren, int depth) throws EvaluationException
visit
in class PostfixTreeWalker
EvaluationException
protected void visit(ASTOpNode node, int nchildren, int depth) throws EvaluationException
visit
in class PostfixTreeWalker
EvaluationException
protected void visit(ASTVarNode node, int nchildren, int depth)
visit
in class PostfixTreeWalker
protected void visit(ASTConstant node, int nchildren, int depth) throws EvaluationException
visit
in class PostfixTreeWalker
EvaluationException
protected boolean supressExaminingChildren(Node child)
PostfixTreeWalker
supressExaminingChildren
in class PostfixTreeWalker
public java.lang.Object eval(Node node) throws EvaluationException
Evaluator
eval
in interface Evaluator
EvaluationException
public void init(Jep jep)
JepComponent
init
in interface JepComponent
jep
- the current Jep instancepublic JepComponent getLightWeightInstance()
getLightWeightInstance
in interface JepComponent
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |