Package nz.org.riskscape.pipeline.ast
Class ParameterReplacer
java.lang.Object
nz.org.riskscape.rl.ast.ExpressionConverter<List<ParameterToken>>
nz.org.riskscape.pipeline.ast.ParameterReplacer
- All Implemented Interfaces:
ExpressionVisitor<List<ParameterToken>,
Expression>
An ExpressionVisitor
that rewrites an expression by replacing any parameters it has found with substitutions
from the visitor's map of replacements.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionA map of ParameterToken to Expressions that are used to rewrite expressions.visit
(ParameterToken parameterToken, List<ParameterToken> missing)
-
Constructor Details
-
ParameterReplacer
-
-
Method Details
-
visit
- Specified by:
visit
in interfaceExpressionVisitor<List<ParameterToken>,
Expression> - Overrides:
visit
in classExpressionConverter<List<ParameterToken>>
-
getReplacements
A map of ParameterToken to Expressions that are used to rewrite expressions. Whenever a ParameterToken is found in the expression being visited, this map is queried for the found ParameterToken and the mapped Expression replaces the found ParameterToken.
E.g. The expression
foo($bar, baz) + $barry
would change tofoo(bar_replacement(), baz) + $barry
if the replacements map was{$bar: bar_replacement()}
-