public class SubstitutionVisitor extends DoNothingVisitor
XJep.substitute method.
For example
XJepI xjep = ...;
Node node = xjep.parse("x^2+x");
Node sub = xjep.parse("sin(y)");
Node res = xjep.substitute(node,"x",sub,xjep);
Will give the expression "(sin(y))^2+sin(y)".| Constructor and Description |
|---|
SubstitutionVisitor() |
| Modifier and Type | Method and Description |
|---|---|
Node |
substitute(Node orig,
String[] names,
Node[] replacements,
XJep xj)
Substitutes all occurrences of a set of variable var with a set of replacements.
|
Node |
substitute(Node orig,
String name,
Node replacement,
XJep xj)
Substitutes all occurrences of variable var with replacement.
|
Object |
visit(ASTVarNode node,
Object data) |
acceptChildrenAsArray, visit, visit, visit, visitpublic Node substitute(Node orig, String name, Node replacement, XJep xj) throws ParseException
orig - the expression we wish to perform the substitution onname - the name of the variablereplacement - the expression var is substituted forParseExceptionpublic Node substitute(Node orig, String[] names, Node[] replacements, XJep xj) throws ParseException
orig - the expression we wish to perform the substitution onnames - the names of the variablereplacements - the expression var is substituted forParseExceptionpublic Object visit(ASTVarNode node, Object data) throws ParseException
visit in interface ParserVisitorvisit in class DoNothingVisitorParseExceptionCopyright © 2018. All rights reserved.