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 Object
Base class for functions working on list arguments. Subclasses define the function by
overwriting
getPreliminaryResult(Object, Object) and
getFallBackValue().- Author:
- HBaagil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract EReturns 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.Returns the result of this function given a list of values.
-
Constructor Details
-
FunctionWithListAsArgumentHelper
public FunctionWithListAsArgumentHelper()
-
-
Method Details
-
getResult
Returns the result of this function given a list of values.- Parameters:
listOfValues- A List of values.
-
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
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.
-