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) |
visit, visit, visit, visit
public 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 forParseException
public 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 forParseException
public Object visit(ASTVarNode node, Object data) throws ParseException
visit
in interface ParserVisitor
visit
in class DoNothingVisitor
ParseException
Jas4pp 1.5 © Java Analysis Studio for Particle Physics