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

Duplicating processors without preserving their state. More...

Static Public Member Functions

static void main (String[] args)
 

Detailed Description

Duplicating processors without preserving their state.

Author
Sylvain Hallé Easy

Definition at line 33 of file DuplicateNoState.java.

Member Function Documentation

◆ main()

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

We first create a cumulative processor and a simple GroupProcessor

Definition at line 35 of file DuplicateNoState.java.

36  {
37  /// We first create a cumulative processor and a simple GroupProcessor
38  Cumulate sum1 = new Cumulate(
39  new CumulativeFunction<Number>(Numbers.addition));
40  Connector.connect(sum1, new Print()
41  .setPrefix("sum1: ").setSeparator("\n"));
42 
43  // We then feed a few events to each of them
44  Pushable p_sum1 = sum1.getPushableInput();
45  p_sum1.push(3).push(1).push(4);
46  ///
47 
48  //* Let us now duplicate sum1 and push events to the copy
49  Cumulate sum2 = (Cumulate) sum1.duplicate();
50  Connector.connect(sum2, new Print()
51  .setPrefix("sum2: ").setSeparator("\n"));
52  Pushable p_sum2 = sum2.getPushableInput();
53  p_sum2.push(2).push(7).push(1);
54  //*
55  }

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