Use the Trim and Fork processors to compute the sum of two successive events.
More...
|
static void | main (String[] args) |
|
Use the Trim and Fork processors to compute the sum of two successive events.
The chain of processors in this example can be represented graphically as:
- Author
- Sylvain Hallé Easy
Definition at line 38 of file SumTwo.java.
◆ main()
static void basic.SumTwo.main |
( |
String [] |
args | ) |
|
|
static |
Create a source of arbitrary numbers
Definition at line 40 of file SumTwo.java.
43 QueueSource source =
new QueueSource().setEvents(1, 2, 3, 4, 5, 6);
46 Fork fork =
new Fork(2);
47 Connector.connect(source, fork);
51 ApplyFunction add =
new ApplyFunction(Numbers.addition);
52 Connector.connect(fork, 0, add, 0);
58 Trim trim =
new Trim(1);
59 Connector.connect(fork, 1, trim, 0);
60 Connector.connect(trim, 0, add, 1);
64 Pullable p = add.getPullableOutput();
65 for (
int i = 0; i < 6; i++)
67 float x = (Float) p.pull();
68 System.out.println(
"The event is: " + x);
The documentation for this class was generated from the following file: