Code Examples
A repository of 155 code examples for BeepBeep
basic.TrimPull Class Reference

Use the Trim processor to discard events from the beginning of a stream. More...

Static Public Member Functions

static void main (String[] args)
 

Detailed Description

Use the Trim processor to discard events from the beginning of a stream.

The chain of processors in this example can be represented graphically as:

Processor graph
See also
PipingBinary
Author
Sylvain Hallé Easy

Definition at line 36 of file TrimPull.java.

Member Function Documentation

◆ main()

static void basic.TrimPull.main ( String []  args)
static

Create a source of arbitrary numbers

Definition at line 38 of file TrimPull.java.

39  {
40  /// Create a source of arbitrary numbers
41  QueueSource source = new QueueSource().setEvents(1, 2, 3, 4, 5, 6);
42 
43  /* Create an instance of the Trim processor. This processor is
44  * instructed to discard the first 3 events it receives. */
45  Trim trim = new Trim(3);
46 
47  /* Connect the trim processor to the output of the source. */
48  Connector.connect(source, trim);
49 
50  /* Let us now print what we receive by pulling on the output of
51  * doubler. */
52  Pullable p = trim.getPullableOutput();
53  for (int i = 0; i < 6; i++)
54  {
55  int x = (Integer) p.pull();
56  System.out.println("The event is: " + x);
57  }
58  ///
59  }

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