Class LoopNode
java.lang.Object
com.singularsys.jep.parser.SimpleNode
com.singularsys.extensions.structure.StructureNode
com.singularsys.extensions.structure.LoopNode
- All Implemented Interfaces:
Node
A node represents a looping construct such as a
for or while loop.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSpecial values to indicate break and continue statements Used byControlRuleandControlNode.Nested classes/interfaces inherited from interface com.singularsys.jep.parser.Node
Node.HookKey -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.singularsys.extensions.structure.StructureNode
getName, getOperator, getPFMC, getValue, getVar, testConditionMethods inherited from class com.singularsys.jep.parser.SimpleNode
childIterator, children, childrenAccept, dump, getChildren, getHook, getId, hookKeys, jjtAccept, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent, removeHook, setHook, toString
-
Constructor Details
-
LoopNode
Constructor.- Parameters:
initializer- node evaluate at start of loop, can be nullcondition- evaluated and tested before each evaluation, can be nullincrement- evaluated after each iteration, can be nullbody- evaluated once per iteration
-
-
Method Details
-
getInitializer
-
getCondition
-
getIncrement
-
getBody
-
toString
-
eval
Evaluate the Loop.- First evaluate the initialisation (if given)
- Evaluate the condition (if given), if result is false exit
- Evaluate the body, if the result is break exit
- Evaluate the increment (if given)
- loop to 2
- Specified by:
evalin classStructureNode- Parameters:
ev- The evaluator theEvaluator.eval(com.singularsys.jep.parser.Node)can be used to evaluate children.- Returns:
- result of evaluation
- Throws:
EvaluationException- if evaluation cannot be performed
-