Package org.faktorips.runtime.formula
Class FormulaEvaluatorUtil.FunctionWithListAsArgumentHelper<E>
- java.lang.Object
-
- org.faktorips.runtime.formula.FormulaEvaluatorUtil.FunctionWithListAsArgumentHelper<E>
-
- Enclosing class:
- FormulaEvaluatorUtil
public abstract static class FormulaEvaluatorUtil.FunctionWithListAsArgumentHelper<E> extends java.lang.ObjectBase class for functions working on list arguments. Subclasses define the function by overwritinggetPreliminaryResult(Object, Object)andgetFallBackValue().- Author:
- HBaagil
-
-
Constructor Summary
Constructors Constructor Description FunctionWithListAsArgumentHelper()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract EgetFallBackValue()Returns the value this function defaults to if an empty list or null is given as an argument.abstract EgetPreliminaryResult(E currentResult, E nextValue)Calculates a preliminary result based on the current result and the next value in the list.EgetResult(java.util.List<E> listOfValues)Returns the result of this function given a list of values.
-
-
-
Method Detail
-
getResult
public E getResult(java.util.List<E> listOfValues)
Returns the result of this function given a list of values.- Parameters:
listOfValues- A List of values.
-
getFallBackValue
public abstract E getFallBackValue()
Returns the value this function defaults to if an empty list or null is given as an argument. E.g. for the function sum, the fall back value is 0.
-
getPreliminaryResult
public abstract E getPreliminaryResult(E currentResult, E nextValue)
Calculates a preliminary result based on the current result and the next value in the list.- Parameters:
currentResult- The current result calculated up to this point.nextValue- The value to be considered next.- Returns:
- The result of the operation defined by subclasses.
-
-