private final int intermediateChannel;
private Aggregator(AggregationFunctionDefinition functionDefinition, Step step)
{
AggregationFunction function = functionDefinition.getFunction();
if (step == Step.FINAL) {
checkArgument(functionDefinition.getInputs().size() == 1, "Expected a single input for an intermediate aggregation");
intermediateChannel = functionDefinition.getInputs().get(0).getChannel();
aggregation = function.createGroupedIntermediateAggregation(functionDefinition.getConfidence());
}
else {
int[] argumentChannels = new int[functionDefinition.getInputs().size()];
for (int i = 0; i < argumentChannels.length; i++) {
argumentChannels[i] = functionDefinition.getInputs().get(i).getChannel();
}
intermediateChannel = -1;
aggregation = function.createGroupedAggregation(
functionDefinition.getMask().transform(Input.channelGetter()),
functionDefinition.getSampleWeight().transform(Input.channelGetter()),
functionDefinition.getConfidence(),
argumentChannels);
}