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 Eval
for an example of this.
See ParserVisitor
for details on the VisitorPattern.Constructor and Description |
---|
CommandVisitor()
private default constructor to prevent init without a tree utils
|
Modifier and Type | Method and Description |
---|---|
Node |
process(Node node,
XJep xj)
Descends the tree processing all diff, eval and simplify options
|
java.lang.Object |
visit(ASTFunNode node,
java.lang.Object data) |
acceptChildrenAsArray, visit, visit, visit, visit
public CommandVisitor()
public Node process(Node node, XJep xj) throws ParseException
ParseException
public java.lang.Object visit(ASTFunNode node, java.lang.Object data) throws ParseException
visit
in interface ParserVisitor
visit
in class DoNothingVisitor
ParseException
http://www.singularsys.com/jep Copyright © 2007 Singular Systems