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.tmf.QueueSource;
24 import ca.uqac.lif.cep.util.Numbers;
38 public static void main (String[] args)
41 QueueSource source1 =
new QueueSource();
42 source1.setEvents(2, 7, 1, 8, 3);
43 QueueSource source2 =
new QueueSource();
44 source2.setEvents(3, 1, 4, 1, 6);
45 ApplyFunction add =
new ApplyFunction(Numbers.addition);
46 Connector.connect(source1, 0, add, 0);
47 Connector.connect(source2, 0, add, 1);
48 Pullable p = add.getPullableOutput();
49 for (
int i = 0; i < 5; i++)
51 float x = (Float) p.pull();
52 System.out.println(
"The event is: " + x);
Apply a binary function on an input stream using the ApplyFunction processor.