Package com.singularsys.jep.walkers
Class LightWeightImportationVisitor
java.lang.Object
com.singularsys.jep.walkers.GenericDoNothingVisitor<Void>
com.singularsys.jep.walkers.GenericDeepCopyVisitor<Void>
com.singularsys.jep.walkers.LightWeightImportationVisitor
- All Implemented Interfaces:
GenericVisitor<Node,,Void, ParseException> JepComponent,Serializable
A variant off the
ImportationVisitor
that uses either the same pfmc for a node
or its getLightWeightInstance() if the function implements
JepComponent. The ImportationVisitor
finds the function by looking it up in the FunctionTable.
This class is used by the MacroFunction
to ensure that these work correctly with the com.singularsys.jep.misc.overloadedfunctions package.
Jep sourceJep = ...;
Jep destJep = ...;
LightWeightImportationVisitor iv = new LightWeightImportationVisitor(destJep);
Node node = sourceJep.parse("x^2-y^2");
Node imported = iv.importEqn(node);
- Since:
- Jep 4.1
- See Also:
-
Field Summary
Fields inherited from class com.singularsys.jep.walkers.GenericDoNothingVisitor
ft, nf, ot -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionImport an equation from another Jep instance.visit(ASTFunNode node, Void data) Creates a new function node, using the same pfmc, or its lightweight instance if the function implementsJepComponent.Create a new operator node, using the same operator.visit(ASTVarNode node, Void data) Uses the name of the variable rather than the variable reference to create the nodeMethods inherited from class com.singularsys.jep.walkers.GenericDeepCopyVisitor
getLightWeightInstance, visit, visitMethods inherited from class com.singularsys.jep.walkers.GenericDoNothingVisitor
childrenHaveChanged, copyChildrenIfNeeded, copyChildrenIfNeeded, init, makeExceptionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.singularsys.jep.GenericVisitor
makeException, visitChildren
-
Constructor Details
-
LightWeightImportationVisitor
-
-
Method Details
-
visit
Uses the name of the variable rather than the variable reference to create the node- Specified by:
visitin interfaceGenericVisitor<Node,Void, ParseException> - Overrides:
visitin classGenericDeepCopyVisitor<Void>- Parameters:
node- current nodedata- context data- Returns:
- the result of visiting the node
- Throws:
ParseException
-
visit
Creates a new function node, using the same pfmc, or its lightweight instance if the function implementsJepComponent.- Specified by:
visitin interfaceGenericVisitor<Node,Void, ParseException> - Overrides:
visitin classGenericDeepCopyVisitor<Void>- Parameters:
node- node to copydata- ignored- Returns:
- a new node
- Throws:
ParseException
-
visit
Create a new operator node, using the same operator. The Node's pfmc, either the nodes pfmc or its lightWeight instance.- Specified by:
visitin interfaceGenericVisitor<Node,Void, ParseException> - Overrides:
visitin classGenericDeepCopyVisitor<Void>- Parameters:
node- current nodedata- context data- Returns:
- the result of visiting the node
- Throws:
ParseException
-
importEqn
Import an equation from another Jep instance.- Parameters:
node- the node to import- Returns:
- a copy of the node, with the same pfmc or its lightWeightInstance
if the pfmc implements
JepComponent - Throws:
ParseException
-