Class EvaluationVisitor.ContainerIterationExecutor
java.lang.Object
net.ssehub.easy.varModel.cstEvaluation.EvaluationVisitor.ContainerIterationExecutor
- Enclosing class:
EvaluationVisitor
Implements flattening/non-flattening container evaluation.
- Author:
- Holger Eichelberger
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ContainerOperationCallprivate ContainerValueprivate IDecisionVariableprivate LocalDecisionVariable[]private IIteratorEvaluatorprivate int[]private VariableAccessor -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateContainerIterationExecutor(ContainerOperationCall call, LocalDecisionVariable[] declarators, VariableAccessor resultVar, IIteratorEvaluator evaluator) Creates a container iteration executor with own context. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidDetermines the container value to iterate over from the container expression.private booleanevaluateIterator(int iter, Value iterVal, IDecisionVariable iterVar, int maxIter, boolean setSelf, EvaluationAccessor rVar) Evaluates an iterator.private booleanexecute(int iterCount) Evaluate for the given number of iterators.private booleaninitialize(ContainerValue[] containers, LocalDecisionVariable[] declarators) Initialize the container iterators for a container iteration.
-
Field Details
-
call
-
declarators
-
resultVar
-
evaluator
-
data
-
pos
private int[] pos -
containerValue
-
containerVariable
-
-
Constructor Details
-
ContainerIterationExecutor
private ContainerIterationExecutor(ContainerOperationCall call, LocalDecisionVariable[] declarators, VariableAccessor resultVar, IIteratorEvaluator evaluator) Creates a container iteration executor with own context.- Parameters:
call- the call to evaluatedeclarators- the declaratorsresultVar- the result variable / declaratorevaluator- the evaluator forcall
-
-
Method Details
-
determineContainer
private void determineContainer()Determines the container value to iterate over from the container expression. If needed, create an implicit temporary container (if operation is applied to a non-container variable). -
initialize
Initialize the container iterators for a container iteration.- Parameters:
containers- the containers to be assigned to the declaratorsdeclarators- the declarators- Returns:
trueif initialization was successful,falseelse
-
execute
private boolean execute(int iterCount) Evaluate for the given number of iterators.- Parameters:
iterCount- the number of iterators- Returns:
truefor success,falseelse
-
evaluateIterator
private boolean evaluateIterator(int iter, Value iterVal, IDecisionVariable iterVar, int maxIter, boolean setSelf, EvaluationAccessor rVar) Evaluates an iterator. Considers the nesting mode and flattens/builds up sub-collections if needed.- Parameters:
iter- the declarator iteration indexiterVal- the actual value of the iteratoriterVar- the alternative iterator variable (may be null)maxIter- the maximum iteration indexsetSelf- whetherEvaluationVisitor.selfValueshall be modifiedrVar- the result value accessor- Returns:
- whether the execution was ok (
true) or notfalse)
-