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.util.Booleans;
39 public static void main(String[] args)
42 QueueSource source =
new QueueSource()
43 .setEvents(
true,
true,
false,
true,
true);
44 Cumulate and =
new Cumulate(
45 new CumulativeFunction<Boolean>(Booleans.and));
46 Connector.connect(source, and);
47 Pullable p = and.getPullableOutput();
48 for (
int i = 0; i < 5; i++)
50 System.out.println(
"The event is: " + p.pull());
Use a cumulative processor to perform the conjunction of a stream of Boolean values.