Filter a trace by evaluating a simple condition on the events of that trace.
More...
|
static void | main (String[] args) |
|
Filter a trace by evaluating a simple condition on the events of that trace.
This example can be represented grahpically as:
- Author
- Sylvain Hallé Easy
Definition at line 41 of file FilterConditionSimple.java.
◆ main()
static void basic.FilterConditionSimple.main |
( |
String [] |
args | ) |
|
|
static |
Create a trace of dummy values
Definition at line 43 of file FilterConditionSimple.java.
46 QueueSource source_values =
new QueueSource();
47 source_values.setEvents(6, 5, 3, 8, 9, 2, 1, 7, 4);
49 Fork fork =
new Fork(2);
50 connect(source_values, fork);
52 Filter filter =
new Filter();
53 connect(fork, LEFT, filter, LEFT);
55 ApplyFunction condition =
new ApplyFunction(Numbers.isEven);
57 connect(fork, RIGHT, condition, INPUT);
59 connect(condition, OUTPUT, filter, RIGHT);
61 Pullable p = filter.getPullableOutput();
64 for (
int i = 0; i < 4; i++)
66 int x = (Integer) p.pull();
67 System.out.printf(
"Output event #%d is %d\n", i, x);
The documentation for this class was generated from the following file: