Class ContainerIterators.NumberIteratorEvaluator
- java.lang.Object
-
- net.ssehub.easy.varModel.cstEvaluation.ContainerIterators.NumberIteratorEvaluator
-
- All Implemented Interfaces:
IIteratorEvaluator
- Enclosing class:
- ContainerIterators
private abstract static class ContainerIterators.NumberIteratorEvaluator extends java.lang.Object implements IIteratorEvaluator
A number aggregating iterator.- Author:
- Holger Eichelberger
-
-
Constructor Summary
Constructors Modifier Constructor Description privateNumberIteratorEvaluator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description BooleanValueaggregate(EvaluationAccessor result, Value iter, EvaluationAccessor value, java.util.Map<java.lang.Object,java.lang.Object> data)Aggregatevaluetoresult.protected abstract doubledoubleOp(double d1, double d2)Performs the double aggregation operation.ValuegetStartResult(IDatatype type, IDatatype iterType)Returns the start result.protected abstract intintOp(int i1, int i2)Performs the integer aggregation operation.voidpostProcessResult(EvaluationAccessor result, java.util.Map<java.lang.Object,java.lang.Object> data)Called to post-process the actual result at the end after the last iteration.
-
-
-
Method Detail
-
intOp
protected abstract int intOp(int i1, int i2)Performs the integer aggregation operation.- Parameters:
i1- the first integeri2- the second integer- Returns:
- the aggregated value
-
doubleOp
protected abstract double doubleOp(double d1, double d2)Performs the double aggregation operation.- Parameters:
d1- the first doubled2- the second double- Returns:
- the aggregated value
-
aggregate
public BooleanValue aggregate(EvaluationAccessor result, Value iter, EvaluationAccessor value, java.util.Map<java.lang.Object,java.lang.Object> data) throws ValueDoesNotMatchTypeException
Description copied from interface:IIteratorEvaluatorAggregatevaluetoresult.- Specified by:
aggregatein interfaceIIteratorEvaluator- Parameters:
result- the aggregating resultiter- the current value of the iteratorvalue- the value to be aggregateddata- arbitrary data to be hold while actually evaluating the function- Returns:
- a boolean value to indicate whether iteration/evaluation shall stop (
trueif iteration shall stop due to this evaluation,falseelse), a collection of values as instance ofListWrapperValuewhere to go on - Throws:
ValueDoesNotMatchTypeException- in case of type compatibility problems
-
getStartResult
public Value getStartResult(IDatatype type, IDatatype iterType) throws ValueDoesNotMatchTypeException
Description copied from interface:IIteratorEvaluatorReturns the start result. Used in case of all operations where the start result is implicitly clear from the operation itself and not explicitly defined in the model.- Specified by:
getStartResultin interfaceIIteratorEvaluator- Parameters:
type- the type of the return valueiterType- the type of the iterator expression- Returns:
- the start value (must comply to
type) - Throws:
ValueDoesNotMatchTypeException- in case of type compatibility problems
-
postProcessResult
public void postProcessResult(EvaluationAccessor result, java.util.Map<java.lang.Object,java.lang.Object> data) throws ValueDoesNotMatchTypeException
Description copied from interface:IIteratorEvaluatorCalled to post-process the actual result at the end after the last iteration.- Specified by:
postProcessResultin interfaceIIteratorEvaluator- Parameters:
result- the aggregated result so fardata- arbitrary data to be hold while actually evaluating the function- Throws:
ValueDoesNotMatchTypeException- in case of type compatibility problems
-
-