20 import ca.uqac.lif.cep.Connector;
21 import ca.uqac.lif.cep.Pullable;
22 import ca.uqac.lif.cep.functions.ApplyFunction;
23 import ca.uqac.lif.cep.functions.Cumulate;
24 import ca.uqac.lif.cep.functions.CumulativeFunction;
25 import ca.uqac.lif.cep.tmf.QueueSource;
26 import ca.uqac.lif.cep.tmf.Window;
27 import ca.uqac.lif.cep.util.Booleans;
28 import ca.uqac.lif.cep.util.Numbers;
42 public static void main(String[] args)
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());
static void main(String[] args)
Use a Window processor to perform a computation over a sliding window of events that are not numeric...