Code Examples
A repository of 155 code examples for BeepBeep
|
Apply an aggregation function on the output of a slicer. More...
Static Public Member Functions | |
static void | main (String[] args) |
Apply an aggregation function on the output of a slicer.
You should first read SlicerSimple. This example starts in the same way; however, it shows how the values of each slice can be aggregated. This is done by first extracting the image (i.e. set of values in each key-value pair) of the map, and then applying a CumulateOnSet function on the resulting set.
In this program, the slicing function is the identity, and the processor given to the slicer is a simple counter that increments every time an event is received. Since there is one such counter for each different input event, the slicer effectively maintains the count of how many times each value has been seen in its input stream. Graphically, this can be represented as:
The expected output of this program is:
1.0 1.0 1.0 1.0 1.0 2.0 2.0 3.0 3.0 …
Definition at line 73 of file SlicerCollapse.java.