Class EvaluationVisitor.ContainerIterationExecutor
- java.lang.Object
-
- net.ssehub.easy.varModel.cstEvaluation.EvaluationVisitor.ContainerIterationExecutor
-
- Enclosing class:
- EvaluationVisitor
private class EvaluationVisitor.ContainerIterationExecutor extends java.lang.ObjectImplements flattening/non-flattening container evaluation.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private ContainerOperationCallcallprivate ContainerValuecontainerValueprivate IDecisionVariablecontainerVariableprivate java.util.Map<java.lang.Object,java.lang.Object>dataprivate LocalDecisionVariable[]declaratorsprivate IIteratorEvaluatorevaluatorprivate int[]posprivate VariableAccessorresultVar
-
Constructor Summary
Constructors Modifier Constructor Description privateContainerIterationExecutor(ContainerOperationCall call, LocalDecisionVariable[] declarators, VariableAccessor resultVar, IIteratorEvaluator evaluator)Creates a container iteration executor with own context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voiddetermineContainer()Determines 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 Detail
-
call
private ContainerOperationCall call
-
declarators
private LocalDecisionVariable[] declarators
-
resultVar
private VariableAccessor resultVar
-
evaluator
private IIteratorEvaluator evaluator
-
data
private java.util.Map<java.lang.Object,java.lang.Object> data
-
pos
private int[] pos
-
containerValue
private ContainerValue containerValue
-
containerVariable
private IDecisionVariable containerVariable
-
-
Constructor Detail
-
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 Detail
-
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
private boolean initialize(ContainerValue[] containers, LocalDecisionVariable[] declarators)
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)
-
-