public class CommandVisitor extends DoNothingVisitor
eval(diff(x ^ 3, x), x, 2)to differentiate x^3 and then substitute x=2 to get the value 12. To use do
Jep j = ...; Node in = ...; TreeUtils tu = new TreeUtils(j); CommandVisitor cv = new CommandVisitor(tu); Node out = cv.process(in);Commands to be executed must implement
CommandVisitorI
and PostfixMathCommandI
. See ParserVisitor
for details on the VisitorPattern.Constructor and Description |
---|
CommandVisitor() |
Modifier and Type | Method and Description |
---|---|
Node |
process(Node node)
Descends the tree processing all diff, eval and simplify options
|
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.
|
childrenHaveChanged, copyChildrenIfNeeded, getFunctionTable, getLightWeightInstance, getNodeFactory, getOperatorTable, getVariableTable, init, visit, visit, visit, visitChildren, visitNode
public Node process(Node node) throws ParseException
ParseException
public java.lang.Object visit(ASTFunNode node, java.lang.Object data) throws JepException
DoNothingVisitor
visit
in interface ParserVisitor
visit
in class DoNothingVisitor
JepException
public java.lang.Object visit(ASTOpNode node, java.lang.Object data) throws JepException
DoNothingVisitor
visit
in interface ParserVisitor
visit
in class DoNothingVisitor
JepException
Copyright © 2018 Singular Systems http://www.singularsys.com/jep