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.Fork;
24 import ca.uqac.lif.cep.tmf.QueueSource;
25 import ca.uqac.lif.cep.tmf.Trim;
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 Fork fork =
new Fork(2);
47 Connector.connect(source, fork);
51 ApplyFunction add =
new ApplyFunction(Numbers.addition);
52 Connector.connect(fork, 0, add, 0);
58 Trim trim =
new Trim(1);
59 Connector.connect(fork, 1, trim, 0);
60 Connector.connect(trim, 0, add, 1);
64 Pullable p = add.getPullableOutput();
65 for (
int i = 0; i < 6; i++)
67 float x = (Float) p.pull();
68 System.out.println(
"The event is: " + x);
static void main(String[] args)
Use the Trim and Fork processors to compute the sum of two successive events.