Use a Window processor to perform a computation over a sliding window of events that are not numeric.
More...
|
static void | main (String[] args) |
|
Use a Window processor to perform a computation over a sliding window of events that are not numeric.
The chain of processors in this example can be represented graphically as:
- Author
- Sylvain Hallé Easy
Definition at line 40 of file WindowEven.java.
◆ main()
static void basic.WindowEven.main |
( |
String [] |
args | ) |
|
|
static |
Create a source of arbitrary numbers
Definition at line 42 of file WindowEven.java.
45 QueueSource source =
new QueueSource().setEvents(2, 7, 1, 8, 2, 8, 1, 8, 2, 8);
48 ApplyFunction is_even =
new ApplyFunction(Numbers.isEven);
49 Connector.connect(source, is_even);
52 Cumulate sum =
new Cumulate(
53 new CumulativeFunction<Boolean>(Booleans.or));
57 Window win =
new Window(sum, 3);
58 Connector.connect(is_even, win);
61 Pullable p = win.getPullableOutput();
62 for (
int i = 0; i < 10; i++)
64 System.out.println(
"Window #" + i +
": " + p.pull());
The documentation for this class was generated from the following file: