Code Examples
A repository of 155 code examples for BeepBeep
util.BagsContains Class Reference

Usage of the Bags.contains function. More...

Static Public Member Functions

static void main (String[] args)
 

Detailed Description

Usage of the Bags.contains function.

This chain of processors can be represented graphically as follows:

Processor graph
Author
Sylvain Hallé Easy

Definition at line 39 of file BagsContains.java.

Member Function Documentation

◆ main()

static void util.BagsContains.main ( String []  args)
static

We create a QueueSource; note that this time, each event in

Definition at line 41 of file BagsContains.java.

42  {
43  /// We create a QueueSource; note that this time, each event in
44  // the source is itself a *list*
45  QueueSource src1 = new QueueSource();
46  src1.addEvent(UtilityMethods.createList(1f, 3f, 5f));
47  src1.addEvent(UtilityMethods.createList(4f, 2f));
48  src1.addEvent(UtilityMethods.createList(4f, 4f, 8f));
49  src1.addEvent(UtilityMethods.createList(6f, 4f));
50  // We create a second queue source of 1s
51  QueueSource src2 = new QueueSource();
52  src2.setEvents(1);
53 
54  // We then create a processor chain that will check if
55  // the n-th list contains the number n
56  ApplyFunction contains = new ApplyFunction(Bags.contains);
57  Connector.connect(src1, 0, contains, 0);
58  Cumulate counter = new Cumulate(
59  new CumulativeFunction<Number>(Numbers.addition));
60  Connector.connect(src2, counter);
61  Connector.connect(counter, 0, contains, 1);
62  Pullable p = contains.getPullableOutput();
63  for (int i = 0; i < 4; i++)
64  {
65  System.out.println(p.pull());
66  }
67  ///
68  }

The documentation for this class was generated from the following file: