Class MultiChannelTimeSeriesAggregator.LambdaBasedAggregationFunction<I,CI,O,D,T>
java.lang.Object
de.iip_ecosphere.platform.kiServices.functions.aggregation.MultiChannelTimeSeriesAggregator.LambdaBasedAggregationFunction<I,CI,O,D,T>
- Type Parameters:
I- the input data typeO- the output data typeD- the data point type withinIandOT- the timestamp type withinIandO
- All Implemented Interfaces:
MultiChannelTimeSeriesAggregator.AggregationFunction<I,,CI, O, D, T> MultiChannelTimeSeriesAggregator.CompletionFunction<T>
public static class MultiChannelTimeSeriesAggregator.LambdaBasedAggregationFunction<I,CI,O,D,T>
extends Object
implements MultiChannelTimeSeriesAggregator.AggregationFunction<I,CI,O,D,T>
Basic aggregation function delegating the operations to (lambda) functions.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
ConstructorsConstructorDescriptionLambdaBasedAggregationFunction(Function<I, T> timestampProvider, Function<CI, String> categoryProvider, Function<CI, D> dataProvider, MultiChannelTimeSeriesAggregator.CompletionFunction<T> completionFunction, Function<Integer, MultiChannelTimeSeriesAggregator.ResultBuilder<O, D, T>> resultBuilderProvider) Creates a lambda based aggregation function. -
Method Summary
Modifier and TypeMethodDescriptionbooleanchunkCompleted(int numberAggregatedSamples, T timestamp) Returns whether an aggregation chunk has been completed and a result instance shall be created.createResult(int categoriesCount) Creates a result builder for composing a potentially multi-category result.getCategory(CI input) Returns the aggregation category frominput.Returns a data point frominput.getTimestamp(I input) Returns the aggregation timestamp frominput.
-
Field Details
-
timestampProvider
-
categoryProvider
-
dataProvider
-
completionFunction
-
resultBuilderProvider
-
-
Constructor Details
-
LambdaBasedAggregationFunction
public LambdaBasedAggregationFunction(Function<I, T> timestampProvider, Function<CI, String> categoryProvider, Function<CI, D> dataProvider, MultiChannelTimeSeriesAggregator.CompletionFunction<T> completionFunction, Function<Integer, MultiChannelTimeSeriesAggregator.ResultBuilder<O, D, T>> resultBuilderProvider) Creates a lambda based aggregation function. All parameters must not be null.- Parameters:
timestampProvider- the timestamp provider implementinggetTimestamp(Object)categoryProvider- the timestamp provider implementinggetCategory(Object)dataProvider- the data provider implementinggetData(Object)completionFunction- the completion function provider implementingchunkCompleted(int, Object)resultBuilderProvider- the result builder function provider implementingcreateResult(int)
-
-
Method Details
-
getTimestamp
Description copied from interface:MultiChannelTimeSeriesAggregator.AggregationFunctionReturns the aggregation timestamp frominput.- Specified by:
getTimestampin interfaceMultiChannelTimeSeriesAggregator.AggregationFunction<I,CI, O, D, T> - Parameters:
input- the input data- Returns:
- the timestamp from
input
-
getCategory
Description copied from interface:MultiChannelTimeSeriesAggregator.AggregationFunctionReturns the aggregation category frominput.- Specified by:
getCategoryin interfaceMultiChannelTimeSeriesAggregator.AggregationFunction<I,CI, O, D, T> - Parameters:
input- the input data- Returns:
- the category from
input
-
getData
Description copied from interface:MultiChannelTimeSeriesAggregator.AggregationFunctionReturns a data point frominput. -
chunkCompleted
Description copied from interface:MultiChannelTimeSeriesAggregator.CompletionFunctionReturns whether an aggregation chunk has been completed and a result instance shall be created.- Specified by:
chunkCompletedin interfaceMultiChannelTimeSeriesAggregator.CompletionFunction<I>- Parameters:
numberAggregatedSamples- the number of samples aggregated so fartimestamp- the timestamp the aggregation started- Returns:
truefor completed,falseelse
-
createResult
Description copied from interface:MultiChannelTimeSeriesAggregator.AggregationFunctionCreates a result builder for composing a potentially multi-category result.- Specified by:
createResultin interfaceMultiChannelTimeSeriesAggregator.AggregationFunction<I,CI, O, D, T> - Parameters:
categoriesCount- the actual number of categories- Returns:
- the result builder instance
-