20 import java.util.Queue;
22 import ca.uqac.lif.cep.Adder;
23 import ca.uqac.lif.cep.Connector;
24 import ca.uqac.lif.cep.Pullable;
25 import ca.uqac.lif.cep.UtilityMethods;
26 import ca.uqac.lif.cep.tmf.QueueSource;
44 public static void main (String[] args)
47 SlowQueueSource source1 =
new SlowQueueSource();
48 source1.setEvents(2, 7, 1, 8, 3);
49 QueueSource source2 =
new QueueSource();
50 source2.setEvents(3, 1, 4, 1, 6);
51 Adder add =
new Adder();
52 Connector.connect(source1, 0, add, 0);
53 Connector.connect(source2, 0, add, 1);
54 Pullable p = add.getPullableOutput();
55 for (
int i = 0; i < 5; i++)
57 float x = (Float) p.pull();
58 System.out.println(
"The event is: " + x);
67 public static class SlowQueueSource
extends QueueSource
70 public boolean compute(Object[] inputs, Queue<Object[]> outputs)
72 UtilityMethods.pause(5000);
73 return super.compute(inputs, outputs);
Pipe processors together using the Connector object.