Package com.singularsys.jep.walkers

# Class GenericDeepCopyVisitor<D>

java.lang.Object
com.singularsys.jep.walkers.GenericDoNothingVisitor<D>
com.singularsys.jep.walkers.GenericDeepCopyVisitor<D>

Type Parameters:
  `D` - the type of the data passed to the visit methods

All Implemented Interfaces:
  `GenericVisitor<Node,D,ParseException>`, `JepComponent`, `Serializable`

Direct Known Subclasses:
  `ExpressionConsolidator`, `ImportationVisitor`, `LightWeightImportationVisitor`

public class GenericDeepCopyVisitor<D> extends GenericDoNothingVisitor<D>
A Visitor which returns an exact copy of the tree, creating new nodes for each type. This class should be extended by visitors which modify trees and creates a new tree.

Since:
  Jep 4.1
See Also:
  - Serialized Form

- ## Field Summary

  ### Fields inherited from class com.singularsys.jep.walkers.GenericDoNothingVisitor

  `ft, nf, ot`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GenericDeepCopyVisitor()`
  Constructor to use as a JepComponent.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `JepComponent`
  `getLightWeightInstance()`
  Gets a light-weight instance suitable for using in multiple threads.
  `Node`
  `visit(ASTConstant node, D data)`
  Visit a constant node
  `Node`
  `visit(ASTFunNode node, D data)`
  Visit a function node
  `Node`
  `visit(ASTOpNode node, D data)`
  Visit an operator node
  `Node`
  `visit(ASTVarNode node, D data)`
  Visit a variable node
  `Node`
  `visit(Node node, D data)`
  Visit a node calling the appropriate overloaded method.

  ### Methods inherited from class com.singularsys.jep.walkers.GenericDoNothingVisitor

  `childrenHaveChanged, copyChildrenIfNeeded, copyChildrenIfNeeded, init, makeException`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface com.singularsys.jep.GenericVisitor

  `makeException, visitChildren`

- ## Constructor Details

  - ### GenericDeepCopyVisitor

    public GenericDeepCopyVisitor()
    Constructor to use as a JepComponent. `GenericDoNothingVisitor.init(Jep)` must be called later.

- ## Method Details

  - ### visit

    public Node visit(Node node, D data) throws ParseException
    Description copied from interface: `GenericVisitor`
    Visit a node calling the appropriate overloaded method.
    Parameters:
      `node` - current node
      `data` - context data passed to each child
    Returns:
      result of visiting the node
    Throws:
      `ParseException`

  - ### visit

    public Node visit(ASTConstant node, D data) throws ParseException
    Description copied from interface: `GenericVisitor`
    Visit a constant node
    Specified by:
      `visit` in interface `GenericVisitor<Node,D,ParseException>`
    Overrides:
      `visit` in class `GenericDoNothingVisitor<D>`
    Parameters:
      `node` - current node
      `data` - context data
    Returns:
      the result of visiting the node
    Throws:
      `ParseException`

  - ### visit

    public Node visit(ASTFunNode node, D data) throws ParseException
    Description copied from interface: `GenericVisitor`
    Visit a function node
    Specified by:
      `visit` in interface `GenericVisitor<Node,D,ParseException>`
    Overrides:
      `visit` in class `GenericDoNothingVisitor<D>`
    Parameters:
      `node` - current node
      `data` - context data
    Returns:
      the result of visiting the node
    Throws:
      `ParseException`

  - ### visit

    public Node visit(ASTOpNode node, D data) throws ParseException
    Description copied from interface: `GenericVisitor`
    Visit an operator node
    Specified by:
      `visit` in interface `GenericVisitor<Node,D,ParseException>`
    Overrides:
      `visit` in class `GenericDoNothingVisitor<D>`
    Parameters:
      `node` - current node
      `data` - context data
    Returns:
      the result of visiting the node
    Throws:
      `ParseException`

  - ### visit

    public Node visit(ASTVarNode node, D data) throws ParseException
    Description copied from interface: `GenericVisitor`
    Visit a variable node
    Specified by:
      `visit` in interface `GenericVisitor<Node,D,ParseException>`
    Overrides:
      `visit` in class `GenericDoNothingVisitor<D>`
    Parameters:
      `node` - current node
      `data` - context data
    Returns:
      the result of visiting the node
    Throws:
      `ParseException`

  - ### 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`
    Overrides:
      `getLightWeightInstance` in class `GenericDoNothingVisitor<D>`
    Returns:
      either a new instance, null or 'this'.