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

Pipe processors together using the Connector object. More...

Static Public Member Functions

static void main (String[] args)
 

Detailed Description

Pipe processors together using the Connector object.

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

Processor graph

This example works like PipingBinary, except that it operates in push mode instead of pull mode.

The expected output of this program is:

0,2,4,6,8,10,12,14,
See also
PipingBinary
Author
Sylvain Hallé Easy

Definition at line 44 of file PipingUnaryPush.java.

Member Function Documentation

◆ main()

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

Create an instance of the Doubler processor.

Definition at line 46 of file PipingUnaryPush.java.

47  {
48  /// Create an instance of the Doubler processor.
49  Doubler doubler = new Doubler();
50 
51  /* Create a processor that simply prints to the console every event
52  * it receives */
53  Print print = new Print();
54 
55  /* We now want to connect the output of doubler to the input of print.
56  * This connection is done by using static method connect() of the
57  * Connector object. */
58  Connector.connect(doubler, print);
59 
60  /* Let us now push events to the doubler. */
61  Pushable p = doubler.getPushableInput();
62  for (int i = 0; i < 8; i++)
63  {
64  p.push(i);
65  // Sleep a little in between so you have time to read
66  UtilityMethods.pause(1000);
67  }
68  ///
69  }

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