|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.singularsys.jep.walkers.PostfixTreeWalker
public abstract class PostfixTreeWalker
Base class for routines which use a non recursive tree walker strategy. The typical recursive strategy can use a lot of stack frames for very large expressions these can cause a stack overflow exception. Subclasses should implement the visit methods. to transverse the various nodes. In general these methods should not recursively walk the child nodes. This class uses a postfix transversal scheme hence the nodes of '1+2' will be visited in the order 1,2,+.
PrefixTreeWalker| Constructor Summary | |
|---|---|
PostfixTreeWalker()
|
|
| Method Summary | |
|---|---|
protected boolean |
supressExaminingChildren(Node child)
Whether to examine the children of this nodes. |
protected abstract void |
visit(ASTConstant node,
int nchildren,
int depth)
Visit a constant node |
protected abstract void |
visit(ASTFunNode node,
int nchildren,
int depth)
Visit a function node |
protected abstract void |
visit(ASTOpNode node,
int nchildren,
int depth)
Visit an operator node |
protected abstract void |
visit(ASTVarNode node,
int nchildren,
int depth)
Visit a variable node |
protected void |
walk(Node top)
Start transversal of the expression. |
protected void |
walkSubEquations(Node top)
If a supressExaminingChildren() returns true, then the children of the node will not be visited by default. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PostfixTreeWalker()
| Method Detail |
|---|
protected void walk(Node top)
throws JepException
top - top node for the expression
java.lang.Exception
JepExceptionprotected boolean supressExaminingChildren(Node child)
child -
protected void walkSubEquations(Node top)
throws JepException
top -
JepException
protected abstract void visit(ASTFunNode node,
int nchildren,
int depth)
throws JepException
node - the current node being visitednchildren - number of children of the nodedepth - depth of tree, root node is depth 1.
JepException
protected abstract void visit(ASTOpNode node,
int nchildren,
int depth)
throws JepException
node - the current node being visitednchildren - number of children of the nodedepth - depth of tree, root node is depth 1.
JepException
protected abstract void visit(ASTVarNode node,
int nchildren,
int depth)
throws JepException
node - the current node being visitednchildren - number of children of the nodedepth - depth of tree, root node is depth 1.
JepException
protected abstract void visit(ASTConstant node,
int nchildren,
int depth)
throws JepException
node - the current node being visitednchildren - number of children of the nodedepth - depth of tree, root node is depth 1.
JepException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||