Code Examples
A repository of 155 code examples for BeepBeep
basic.DuplicateGroup 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 35 of file DuplicateGroup.java.

Member Function Documentation

◆ main()

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

We first create a GroupProcessor

Let us clone gp1 and connect it to a new source

Definition at line 37 of file DuplicateGroup.java.

38  {
39  /// We first create a GroupProcessor
40  QueueSource source1 = new QueueSource().setEvents(3, 1, 4, 1, 5);
41  GroupProcessor gp1 = new GroupProcessor(1, 1);
42  {
43  Stutter st = new Stutter(2);
44  Cumulate sum = new Cumulate(
45  new CumulativeFunction<Number>(Numbers.addition));
46  Connector.connect(st, sum);
47  gp1.addProcessors(st, sum);
48  gp1.associateInput(0, st, 0);
49  gp1.associateOutput(0, sum, 0);
50  }
51  Connector.connect(source1, gp1);
52 
53  // We pull one event from gp1
54  Pullable p_gp1 = gp1.getPullableOutput();
55  System.out.println(p_gp1.pull());
56  ///
57 
58  //! Let us clone gp1 and connect it to a new source
59  QueueSource source2 = new QueueSource().setEvents(2, 7, 1, 8);
60  GroupProcessor gp2 = gp1.duplicate(true);
61  Connector.connect(source2, gp2);
62  Pullable p_gp2 = gp2.getPullableOutput();
63  System.out.println(p_gp2.pull());
64  //!
65  }

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