com.singularsys.jep.walkers

## Class DoNothingVisitor

- java.lang.Object
- - 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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected FunctionTable` | `ft` Convenience reference to the FunctionTable
    `protected Jep` | `jep` Jep instance
    `protected NodeFactory` | `nf` Convenience reference to the NodeFactory
    `protected OperatorTableI` | `ot` Convenience reference to the OperatorTableI
    `protected VariableTable` | `vt` Convenience reference to the VariableTable

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DoNothingVisitor()` Constructor to use with JepComponent mechanism, init method must be called.
    `DoNothingVisitor(Jep j)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `childrenHaveChanged(Node node, Node[] children)` Tests if the children of a node have changed
    `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

      Jep instance

    - #### nf

          protected NodeFactory nf

      Convenience reference to the NodeFactory

    - #### vt

          protected VariableTable vt

      Convenience reference to the VariableTable

    - #### ft

          protected FunctionTable ft

      Convenience reference to the FunctionTable

    - #### ot

          protected OperatorTableI ot

      Convenience reference to the OperatorTableI

  - ### Constructor Detail

    - #### DoNothingVisitor

          public DoNothingVisitor()

      Constructor to use with JepComponent mechanism, init method must be called.

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

    - #### childrenHaveChanged

          protected boolean childrenHaveChanged(Node node,
                                                Node[] children)

      Tests if the children of a node have changed
      Parameters:
        `node` - the original node
        `children` - the new set of children.
      Returns:
        true if the children have changed, false otherwise

    - #### getNodeFactory

          public NodeFactory getNodeFactory()

    - #### getOperatorTable

          public OperatorTableI getOperatorTable()

    - #### getVariableTable

          public VariableTable getVariableTable()

    - #### getFunctionTable

          public FunctionTable getFunctionTable()

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