private final int intermediateChannel;
private Aggregator(AggregationFunctionDefinition functionDefinition, Step step, MemoryManager memoryManager)
{
AggregationFunction function = functionDefinition.getFunction();
if (step != Step.FINAL) {
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.createAggregation(
functionDefinition.getMask().transform(Input.channelGetter()),
functionDefinition.getSampleWeight().transform(Input.channelGetter()),
functionDefinition.getConfidence(),
argumentChannels);
}
else {
checkArgument(functionDefinition.getInputs().size() == 1, "Expected a single input for an intermediate aggregation");
intermediateChannel = functionDefinition.getInputs().get(0).getChannel();
aggregation = function.createIntermediateAggregation(functionDefinition.getConfidence());
}
this.step = step;
this.memoryManager = memoryManager;
}