Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.singularsys.jep.walkers
Class PrefixTreeWalker

    java.lang.Object
      com.singularsys.jep.walkers.PrefixTreeWalker

Direct Known Subclasses:
  PrefixTreeDumper

    public abstract class PrefixTreeWalker

extends java.lang.Object

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 of `ParserVisitor` to transverse the various nodes. In general these methods should not recursively walk the child nodes. This class uses a prefix transversal scheme hence the nodes of '1+2' will be visited in the order +,1,2.

Author:
  Richard Morris
See Also:
  `PostfixTreeWalker`

Constructor Summary
`PrefixTreeWalker()`

Method Summary
`protected abstract void` | `visit(ASTConstant node, int nchildren, int depth)`
`protected abstract void` | `visit(ASTFunNode node, int nchildren, int depth)`
`protected abstract void` | `visit(ASTOpNode node, int nchildren, int depth)`
`protected abstract void` | `visit(ASTVarNode node, int nchildren, int depth)`
`void` | `walk(Node top)` Uses a non-recursive method to traverse the tree under the node 'top'.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PrefixTreeWalker

    public PrefixTreeWalker()

Method Detail

### walk

    public void walk(Node top)
              throws JepException

  Uses a non-recursive method to traverse the tree under the node 'top'.

  Parameters:
    `top` - the top node of the parse tree.
  Throws:
    `JepException`

### visit

    protected abstract void visit(ASTFunNode node,
                                  int nchildren,
                                  int depth)
                           throws JepException

  Throws:
    `JepException`

### visit

    protected abstract void visit(ASTOpNode node,
                                  int nchildren,
                                  int depth)
                           throws JepException

  Throws:
    `JepException`

### visit

    protected abstract void visit(ASTVarNode node,
                                  int nchildren,
                                  int depth)
                           throws JepException

  Throws:
    `JepException`

### visit

    protected abstract void visit(ASTConstant node,
                                  int nchildren,
                                  int depth)
                           throws JepException

  Throws:
    `JepException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008 Singular Systems http://www.singularsys.com/jep