com.singularsys.jep.walkers
Class DoNothingVisitor

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

public class DoNothingVisitor
extends java.lang.Object
implements ParserVisitor, JepComponent

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.

Since:
3.3 number of children no longer needs to be the same
Author:
Rich Morris Created on 16-Nov-2003
See Also:
Serialized Form

Field Summary
protected  FunctionTable ft
           
protected  Jep jep
           
protected  NodeFactory nf
           
protected  OperatorTableI ot
           
protected  VariableTable vt
           
 
Constructor Summary
DoNothingVisitor()
           
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.
 FunctionTable getFunctionTable()
           
 JepComponent getLightWeightInstance()
          Gets a light-weight instance suitable for using in multiple threads.
 NodeFactory getNodeFactory()
           
 OperatorTableI getOperatorTable()
           
 VariableTable getVariableTable()
           
 void init(Jep j)
          Initialize the component.
 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 OperatorTableI ot
Constructor Detail

DoNothingVisitor

public DoNothingVisitor()

DoNothingVisitor

public DoNothingVisitor(Jep j)
Method Detail

getLightWeightInstance

public JepComponent getLightWeightInstance()
Description copied from interface: JepComponent
Gets a light-weight instance suitable for using in multiple threads.

Specified by:
getLightWeightInstance in interface JepComponent
Returns:
this

init

public void init(Jep j)
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:
j - the current Jep instance

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 by 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 by 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

getNodeFactory

public NodeFactory getNodeFactory()

getOperatorTable

public OperatorTableI getOperatorTable()

getVariableTable

public VariableTable getVariableTable()

getFunctionTable

public FunctionTable getFunctionTable()


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