20 import ca.uqac.lif.cep.Connector;
21 import ca.uqac.lif.cep.Pullable;
22 import ca.uqac.lif.cep.functions.Cumulate;
23 import ca.uqac.lif.cep.functions.CumulativeFunction;
24 import ca.uqac.lif.cep.tmf.QueueSource;
25 import ca.uqac.lif.cep.tmf.Window;
26 import ca.uqac.lif.cep.util.Numbers;
40 public static void main(String[] args)
43 QueueSource source =
new QueueSource().setEvents(1, 2, 3, 4, 5, 6);
46 Cumulate sum =
new Cumulate(
47 new CumulativeFunction<Number>(Numbers.addition));
51 Window win =
new Window(sum, 3);
52 Connector.connect(source, win);
55 Pullable p = win.getPullableOutput();
56 System.out.println(
"First window: " + p.pull());
57 System.out.println(
"Second window: " + p.pull());
58 System.out.println(
"Third window: " + p.pull());
static void main(String[] args)
Use a Window processor to perform a computation over a sliding window of events.