com.singularsys.jep.walkers
Class DeepCopyVisitor

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

public class DeepCopyVisitor
extends DoNothingVisitor

A Visitor which returns an exact copy of the tree. This class should be extended by visitors which modify trees and creates a new tree.

Author:
Rich Morris Created on 16-Nov-2003
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.singularsys.jep.walkers.DoNothingVisitor
ft, jep, nf, ot, vt
 
Constructor Summary
DeepCopyVisitor()
          Constructor to use as a JepComponent.
DeepCopyVisitor(Jep j)
          Constructor to use in a standalone context.
 
Method Summary
 Node deepCopy(Node node)
          Creates a deepCopy of a Node
 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.
 
Methods inherited from class com.singularsys.jep.walkers.DoNothingVisitor
copyChildrenIfNeeded, getFunctionTable, getLightWeightInstance, getNodeFactory, getOperatorTable, getVariableTable, init, visit, visitChildren, visitNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeepCopyVisitor

public DeepCopyVisitor(Jep j)
Constructor to use in a standalone context.

Parameters:
j - Jep instance to use.

DeepCopyVisitor

public DeepCopyVisitor()
Constructor to use as a JepComponent. DoNothingVisitor.init(Jep) must be called later.

Method Detail

deepCopy

public Node deepCopy(Node node)
              throws JepException
Creates a deepCopy of a Node

Throws:
JepException

visit

public java.lang.Object visit(ASTConstant node,
                              java.lang.Object data)
                       throws ParseException
Description copied from class: DoNothingVisitor
Visit a constant node. Can be overridden buy sub-classes.

Specified by:
visit in interface ParserVisitor
Overrides:
visit in class DoNothingVisitor
Throws:
ParseException

visit

public java.lang.Object visit(ASTFunNode node,
                              java.lang.Object data)
                       throws JepException
Description copied from class: DoNothingVisitor
Visit a function node. Can be overridden by sub-classes.

Specified by:
visit in interface ParserVisitor
Overrides:
visit in class DoNothingVisitor
Throws:
JepException

visit

public java.lang.Object visit(ASTOpNode node,
                              java.lang.Object data)
                       throws JepException
Description copied from class: DoNothingVisitor
Visit a operator node. Can be overridden by sub-classes.

Specified by:
visit in interface ParserVisitor
Overrides:
visit in class DoNothingVisitor
Throws:
JepException

visit

public java.lang.Object visit(ASTVarNode node,
                              java.lang.Object data)
                       throws ParseException
Description copied from class: DoNothingVisitor
Visit a variable node. Can be overridden buy sub-classes.

Specified by:
visit in interface ParserVisitor
Overrides:
visit in class DoNothingVisitor
Throws:
ParseException


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