20 import ca.uqac.lif.cep.Connector;
21 import ca.uqac.lif.cep.Pushable;
22 import ca.uqac.lif.cep.functions.Cumulate;
23 import ca.uqac.lif.cep.functions.CumulativeFunction;
24 import ca.uqac.lif.cep.io.Print;
25 import ca.uqac.lif.cep.util.Numbers;
35 public static void main(String[] args)
38 Cumulate sum1 =
new Cumulate(
39 new CumulativeFunction<Number>(Numbers.addition));
40 Connector.connect(sum1,
new Print()
41 .setPrefix(
"sum1: ").setSeparator(
"\n"));
44 Pushable p_sum1 = sum1.getPushableInput();
45 p_sum1.push(3).push(1).push(4);
49 Cumulate sum2 = (Cumulate) sum1.duplicate();
50 Connector.connect(sum2,
new Print()
51 .setPrefix(
"sum2: ").setSeparator(
"\n"));
52 Pushable p_sum2 = sum2.getPushableInput();
53 p_sum2.push(2).push(7).push(1);
static void main(String[] args)
Duplicating processors without preserving their state.