20 import ca.uqac.lif.cep.Connector;
21 import ca.uqac.lif.cep.Pushable;
22 import ca.uqac.lif.cep.functions.ApplyFunction;
23 import ca.uqac.lif.cep.functions.ContextVariable;
24 import ca.uqac.lif.cep.functions.FunctionTree;
25 import ca.uqac.lif.cep.functions.StreamVariable;
26 import ca.uqac.lif.cep.io.Print;
27 import ca.uqac.lif.cep.util.Numbers;
38 public static void main(String[] args)
42 ApplyFunction f1 =
new ApplyFunction(
new FunctionTree(
43 Numbers.addition, StreamVariable.X,
new ContextVariable(
"foo")));
44 Connector.connect(f1,
new Print()
45 .setPrefix(
"f1: ").setSeparator(
"\n"));
48 Pushable p_f1 = f1.getPushableInput();
49 f1.setContext(
"foo", 10);
53 ApplyFunction f2 = (ApplyFunction) f1.duplicate();
54 Connector.connect(f2,
new Print()
55 .setPrefix(
"f2: ").setSeparator(
"\n"));
56 Pushable p_f2 = f2.getPushableInput();
57 p_f2.push(2).push(7).push(1);
static void main(String[] args)
Duplicating processors and observing what happens to their Context object.