Encapsulate a chain of processors into a Group.
More...
|
static void | main (String[] args) |
|
Encapsulate a chain of processors into a Group.
The chain of processors in this example can be represented graphically as:
- See also
- SumTwo
- Author
- Sylvain Hallé Easy GroupProcessor#associateInput(int, ca.uqac.lif.cep.Processor, int)
Definition at line 24 of file GroupSimple.java.
◆ main()
static void basic.GroupSimple.main |
( |
String [] |
args | ) |
|
|
static |
Create a source of arbitrary numbers
Definition at line 26 of file GroupSimple.java.
29 QueueSource source =
new QueueSource().setEvents(1, 2, 3, 4, 5, 6);
32 GroupProcessor group =
new GroupProcessor(1, 1);
34 Fork fork =
new Fork(2);
35 ApplyFunction add =
new ApplyFunction(Numbers.addition);
36 Connector.connect(fork, 0, add, 0);
37 Trim trim =
new Trim(1);
38 Connector.connect(fork, 1, trim, 0);
39 Connector.connect(trim, 0, add, 1);
40 group.addProcessors(fork, trim, add);
41 group.associateInput(0, fork, 0);
42 group.associateOutput(0, add, 0);
46 Connector.connect(source, group);
50 Pullable p = group.getPullableOutput();
51 for (
int i = 0; i < 6; i++)
53 float x = (Float) p.pull();
54 System.out.println(
"The event is: " + x);
The documentation for this class was generated from the following file: