Duplicating processors without preserving their state.
More...
|
static void | main (String[] args) |
|
Duplicating processors without preserving their state.
- Author
- Sylvain Hallé Easy
Definition at line 35 of file DuplicateGroup.java.
◆ main()
static void basic.DuplicateGroup.main |
( |
String [] |
args | ) |
|
|
static |
We first create a GroupProcessor
Let us clone gp1 and connect it to a new source
Definition at line 37 of file DuplicateGroup.java.
40 QueueSource source1 =
new QueueSource().setEvents(3, 1, 4, 1, 5);
41 GroupProcessor gp1 =
new GroupProcessor(1, 1);
43 Stutter st =
new Stutter(2);
44 Cumulate sum =
new Cumulate(
45 new CumulativeFunction<Number>(Numbers.addition));
46 Connector.connect(st, sum);
47 gp1.addProcessors(st, sum);
48 gp1.associateInput(0, st, 0);
49 gp1.associateOutput(0, sum, 0);
51 Connector.connect(source1, gp1);
54 Pullable p_gp1 = gp1.getPullableOutput();
55 System.out.println(p_gp1.pull());
59 QueueSource source2 =
new QueueSource().setEvents(2, 7, 1, 8);
60 GroupProcessor gp2 = gp1.duplicate(
true);
61 Connector.connect(source2, gp2);
62 Pullable p_gp2 = gp2.getPullableOutput();
63 System.out.println(p_gp2.pull());
The documentation for this class was generated from the following file: