Class AbstractAggregatingFunction<T,R>
java.lang.Object
com.github.basking2.sdsai.itrex.functions.AbstractAggregatingFunction<T,R>
- Type Parameters:
T
- The input parameter type.R
- The return type.
- All Implemented Interfaces:
FunctionInterface<R>
,BiFunction<Iterator<?>,
EvaluationContext, R>
- Direct Known Subclasses:
AbstractBooleanFunction
public abstract class AbstractAggregatingFunction<T,R>
extends Object
implements FunctionInterface<R>
This defines most of a function that takes a list of Ts, iterators of Ts or iterables over Ts
and transforms them into an R.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionAbstractAggregatingFunction
(R initialValue) Construct an function that will start aggregating values with initialValue as the first R value. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.function.BiFunction
andThen
-
Field Details
-
initialValue
-
-
Constructor Details
-
AbstractAggregatingFunction
Construct an function that will start aggregating values with initialValue as the first R value. If an implementation is summing numbers, initialValue may be 0. If an implementation is building a list, initialValue may be an empty list.- Parameters:
initialValue
- An intial value.
-
-
Method Details
-
apply
- Specified by:
apply
in interfaceBiFunction<Iterator<?>,
EvaluationContext, R>
-
applyT
- Parameters:
r
- Right value.t
- Left value.- Returns:
- A two-tuple which, if the left value is true, aggregation will continue.
-