ConfigurationThis aggregator uses n variables. These variables are updated through expressions that are executed for every element entering the operator. When the input stream is fully consumed, Apollo executes the output expression to create the single value that goes out of the operator. This expression can access all variables. By default, this operator operates in sequential mode (see the configuration below), keeping the element order from the stream. This code sample shows the operator configuration: var element; var var1 = ...// default value var var2 = ...// default value var var3 = ...// default value while((element = getNextValue()) != null && $termination_expression == false) { var1 = ... //update var var2 = ... //update var var3 = ... //update var } return $output_expression; There are 3 phases:
Note:
You can use a termination expression to stop the iteration on the stream
(phase 2) and directly go to the output phase (phase 3).
InputThere is one Input. There are no constraints on the element type or on the number of elements in the stream. OutputThere must be one Output. As an aggregator, this function emits a single value. The type of this value depends on the configuration (Output Expression). Example: Computing a Standard DeviationLet us assume that the average of the values of the stream is already computed and stored
in a global In this example, the input stream is a stream of Integer.
|