com.singularsys.jep.walkers
Class PostfixEvaluator
java.lang.Object
com.singularsys.jep.walkers.PostfixTreeWalker
com.singularsys.jep.walkers.PostfixEvaluator
- All Implemented Interfaces:
- Evaluator, JepComponent, java.io.Serializable
public class PostfixEvaluator
- extends PostfixTreeWalker
- implements Evaluator
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.
- Author:
- Richard Morris
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PostfixEvaluator
public PostfixEvaluator()
evaluate
public java.lang.Object evaluate(Node node)
throws EvaluationException
- Description copied from interface:
Evaluator
- Evaluates a node and returns and object with the value of the node.
- Specified by:
evaluate
in interface Evaluator
- Throws:
EvaluationException
visit
protected void visit(ASTFunNode node,
int nchildren,
int depth)
throws EvaluationException
- Specified by:
visit
in class PostfixTreeWalker
- Throws:
EvaluationException
visit
protected void visit(ASTVarNode node,
int nchildren,
int depth)
- Specified by:
visit
in class PostfixTreeWalker
visit
protected void visit(ASTConstant node,
int nchildren,
int depth)
throws EvaluationException
- Specified by:
visit
in class PostfixTreeWalker
- Throws:
EvaluationException
supressExaminingChildren
protected boolean supressExaminingChildren(Node child)
- Overrides:
supressExaminingChildren
in class PostfixTreeWalker
eval
public java.lang.Object eval(Node node)
throws EvaluationException
- Description copied from interface:
Evaluator
- Evaluates a sub expression.
- Specified by:
eval
in interface Evaluator
- Throws:
EvaluationException
init
public void init(Jep jep)
- Description copied from interface:
JepComponent
- Initialize the component. This methods is called whenever a component
is added to Jep. Hence it allows components to keep track of the other
components they may rely on.
- Specified by:
init
in interface JepComponent
- Parameters:
jep
- the current Jep instance
Copyright © 2007 Singular Systems http://www.singularsys.com/jep