Package com.singularsys.jep.walkers
Class ImportationVisitor
java.lang.Object
com.singularsys.jep.walkers.GenericDoNothingVisitor<Void>
com.singularsys.jep.walkers.GenericDeepCopyVisitor<Void>
com.singularsys.jep.walkers.ImportationVisitor
- All Implemented Interfaces:
GenericVisitor<Node,,Void, ParseException> JepComponent,Serializable
Imports an expression from one Jep instance into another.
This class is quicker than using a SerializableExpression but cannot handle such large equations.
Jep sourceJep = ...;
Jep destJep = ...;
ImportationVisitor iv = new ImportationVisitor(destJep);
Node node = sourceJep.parse("x^2-y^2");
Node imported = iv.importEqn(node);
Since Jep 4.1, this class extends GenericDeepCopyVisitor,
changing some type signatures. The method importEqn(Node)
should be used to import equations,
rather than the deprecated deepCopy(Node).
- Since:
- Jep 3.5
- Author:
- Richard Morris
- See Also:
-
Field Summary
Fields inherited from class com.singularsys.jep.walkers.GenericDoNothingVisitor
ft, nf, ot -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Imports an equation from another Jep instance.visit(ASTFunNode node, Void data) Ensures that functions will be correct for the give Jep instance.Ensures that operators are correct for the given Jep instance.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
-
ImportationVisitor
-
-
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
Ensures that functions will be correct for the give Jep instance. Necessary for functions which implementJepComponent.- 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- Since:
- 4.0
-
visit
Ensures that operators are correct for the given Jep instance. Necessary for functions which implementJepComponent.- 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- Since:
- 4.0
-
importEqn
Imports an equation from another Jep instance.- Parameters:
node- the node to import- Returns:
- a new node, with the same variable names, function names and operator names, but using the functions and operators of the Jep instance used to create this visitor.
- Throws:
ParseException- if there is an error during the importation process.
-
deepCopy
Deprecated.useimportEqn(Node)instead, which is more descriptive.Imports an equation from another Jep instance.- Parameters:
node- the node to import- Returns:
- a new node, with the same variable names, function names and operator names, but using the functions and operators of the Jep instance used to create this visitor.
- Throws:
ParseException- if there is an error during the importation process.
-
importEqn(Node)instead, which is more descriptive.