com.singularsys.aa.manipulation
Class Substituter

java.lang.Object
  extended by com.singularsys.aa.manipulation.Substituter
All Implemented Interfaces:
org.nfunk.jep.ParserVisitor

public class Substituter
extends java.lang.Object
implements org.nfunk.jep.ParserVisitor

Author:
nathan

Constructor Summary
Substituter()
           
 
Method Summary
 void substitute(org.nfunk.jep.Node topNode, java.lang.String varName_in, java.lang.Object constant_in)
          Substitutes all occurences of ASTVarNodes with variable name
 java.lang.Object visit(org.nfunk.jep.ASTConstant node, java.lang.Object data)
           
 java.lang.Object visit(org.nfunk.jep.ASTFunNode node, java.lang.Object data)
           
 java.lang.Object visit(org.nfunk.jep.ASTStart node, java.lang.Object data)
           
 java.lang.Object visit(org.nfunk.jep.ASTVarNode node, java.lang.Object data)
           
 java.lang.Object visit(org.nfunk.jep.SimpleNode node, java.lang.Object data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Substituter

public Substituter()
Method Detail

substitute

public void substitute(org.nfunk.jep.Node topNode,
                       java.lang.String varName_in,
                       java.lang.Object constant_in)
Substitutes all occurences of ASTVarNodes with variable name
varName_in
with ASTContant nodes with the value
constant_in
.

Does nothing if any of the arguments are

null
.

Parameters:
topNode - the top node of the tree to be manipulated.
varName_in - the name of the variable to be replaced.
constant_in - the constant to replace the variable with.

visit

public java.lang.Object visit(org.nfunk.jep.ASTFunNode node,
                              java.lang.Object data)
Specified by:
visit in interface org.nfunk.jep.ParserVisitor

visit

public java.lang.Object visit(org.nfunk.jep.ASTVarNode node,
                              java.lang.Object data)
Specified by:
visit in interface org.nfunk.jep.ParserVisitor

visit

public java.lang.Object visit(org.nfunk.jep.ASTConstant node,
                              java.lang.Object data)
Specified by:
visit in interface org.nfunk.jep.ParserVisitor

visit

public java.lang.Object visit(org.nfunk.jep.ASTStart node,
                              java.lang.Object data)
Specified by:
visit in interface org.nfunk.jep.ParserVisitor

visit

public java.lang.Object visit(org.nfunk.jep.SimpleNode node,
                              java.lang.Object data)
Specified by:
visit in interface org.nfunk.jep.ParserVisitor