20 import ca.uqac.lif.cep.Connector;
21 import ca.uqac.lif.cep.Processor;
22 import ca.uqac.lif.cep.Pushable;
23 import ca.uqac.lif.cep.UniformProcessor;
25 import static ca.uqac.lif.cep.Connector.INPUT;
27 import ca.uqac.lif.cep.io.Print;
28 import ca.uqac.lif.cep.tmf.Fork;
29 import java.util.ArrayList;
30 import java.util.List;
45 public static void main(String[] args)
throws InterruptedException
51 Fork fork =
new Fork(3);
57 Print p0 =
new Print().setSeparator(
"\n").setPrefix(
"P0 ");
58 Print p1 =
new Print().setSeparator(
"\n").setPrefix(
"P1 ");
59 Print p2 =
new Print().setSeparator(
"\n").setPrefix(
"P2 ");
63 Processor rf =
new RemoveFirst();
64 Connector.connect(fork, 0, p0, INPUT);
65 Connector.connect(fork, 1, rf, INPUT);
66 Connector.connect(rf, p1);
67 Connector.connect(fork, 2, p2, INPUT);
73 Pushable p = fork.getPushableInput();
74 List<Number> list =
new ArrayList<Number>();
75 list.add(3); list.add(1); list.add(4);
95 protected static class RemoveFirst
extends UniformProcessor
103 protected boolean compute(Object[] inputs, Object[] outputs)
105 List<?> list = (List<?>) inputs[0];
112 public Processor duplicate(
boolean with_state)
See the effect of sending a mutable object into a Fork processor.