Class VariableShifter
java.lang.Object
com.singularsys.extensions.rewrite.VariableShifter
- All Implemented Interfaces:
RewriteVisitor.VariableRuleI,JepComponent,Serializable
Replaces a variable "x" by "x + d" where d is a double value.
This adds a
Node.HookKey to all matching variable nodes.
These can be removed by calling removeHooks(Node)- Since:
- Jep 4.0/Extensions 2.1
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(ASTVarNode node) Rewrites the nodeGets a light-weight instance suitable for using in multiple threads.static Node.HookKeyHook used by this classvoidInitialize the component.static voidremoveHooks(Node node) Remove all instances of the hook used by this classbooleantest(ASTVarNode node) Returns true if node needs to be rewritten, according to this rule.
-
Constructor Details
-
VariableShifter
-
-
Method Details
-
init
Description copied from interface:JepComponentInitialize the component. This method is called whenever a component is added to Jep. Hence, it allows components to keep track of the other components they may rely on.- Specified by:
initin interfaceJepComponent- Parameters:
jep- the current Jep instance
-
getLightWeightInstance
Description copied from interface:JepComponentGets a light-weight instance suitable for using in multiple threads.- Specified by:
getLightWeightInstancein interfaceJepComponent- Returns:
- either a new instance, null or 'this'.
-
test
Description copied from interface:RewriteVisitor.VariableRuleIReturns true if node needs to be rewritten, according to this rule.- Specified by:
testin interfaceRewriteVisitor.VariableRuleI
-
apply
Description copied from interface:RewriteVisitor.VariableRuleIRewrites the node- Specified by:
applyin interfaceRewriteVisitor.VariableRuleI- Throws:
ParseException
-
removeHooks
Remove all instances of the hook used by this class- Parameters:
node-- Throws:
JepException
-
getVariableShifterHook
Hook used by this class- Returns:
-