com.singularsys.jep.walkers
Class DoNothingVisitor

java.lang.Object
  extended by com.singularsys.jep.walkers.DoNothingVisitor
All Implemented Interfaces:
ParserVisitor
Direct Known Subclasses:
DeepCopyVisitor, SubstitutionVisitor

public class DoNothingVisitor
extends java.lang.Object
implements ParserVisitor

A Visitor which visits each node of a expression tree and does nothing. This visitor is intended as a base class for other visitors which manipulate expressions.

This class will always leave the original expression intact, but may reuse unchanged parts of the expression.

Author:
Rich Morris Created on 16-Nov-2003

Field Summary
protected  FunctionTable ft
           
protected  Jep jep
           
protected  NodeFactory nf
           
protected  OperatorTable ot
           
protected  VariableTable vt
           
 
Constructor Summary
DoNothingVisitor(Jep j)
           
 
Method Summary
protected  Node copyChildrenIfNeeded(Node node, Node[] children)
          Sets the children of a node if they have changed for it current children.
 java.lang.Object visit(ASTConstant node, java.lang.Object data)
          Visit a constant node.
 java.lang.Object visit(ASTFunNode node, java.lang.Object data)
          Visit a function node.
 java.lang.Object visit(ASTOpNode node, java.lang.Object data)
          Visit a operator node.
 java.lang.Object visit(ASTVarNode node, java.lang.Object data)
          Visit a variable node.
 Node visit(Node node)
           
protected  Node[] visitChildren(Node node, java.lang.Object data)
          Gets the result of visiting children of a array of nodes.
 Node visitNode(Node node, java.lang.Object data)
          Used to recursively visit the children of a node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jep

protected Jep jep

nf

protected NodeFactory nf

vt

protected VariableTable vt

ft

protected FunctionTable ft

ot

protected OperatorTable ot
Constructor Detail

DoNothingVisitor

public DoNothingVisitor(Jep j)
Method Detail

visit

public Node visit(Node node)
           throws JepException
Throws:
JepException

visitNode

public Node visitNode(Node node,
                      java.lang.Object data)
               throws JepException
Used to recursively visit the children of a node.

Parameters:
node - Node to visit
data - user specified data
Returns:
a Node with the modified tree
Throws:
JepException

visitChildren

protected Node[] visitChildren(Node node,
                               java.lang.Object data)
                        throws JepException
Gets the result of visiting children of a array of nodes.

Parameters:
node - current node being visited
data - user specified data
Returns:
an array of results from visiting each child of the node.
Throws:
JepException

visit

public java.lang.Object visit(ASTConstant node,
                              java.lang.Object data)
                       throws JepException
Visit a constant node. Can be overridden buy sub-classes.

Specified by:
visit in interface ParserVisitor
Throws:
JepException

visit

public java.lang.Object visit(ASTVarNode node,
                              java.lang.Object data)
                       throws JepException
Visit a variable node. Can be overridden buy sub-classes.

Specified by:
visit in interface ParserVisitor
Throws:
JepException

visit

public java.lang.Object visit(ASTFunNode node,
                              java.lang.Object data)
                       throws JepException
Visit a function node. Can be overridden buy sub-classes.

Specified by:
visit in interface ParserVisitor
Throws:
JepException

visit

public java.lang.Object visit(ASTOpNode node,
                              java.lang.Object data)
                       throws JepException
Visit a operator node. Can be overridden buy sub-classes.

Specified by:
visit in interface ParserVisitor
Throws:
JepException

copyChildrenIfNeeded

protected Node copyChildrenIfNeeded(Node node,
                                    Node[] children)
                             throws JepException
Sets the children of a node if they have changed for it current children.

Throws:
JepException


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