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

Duplicating processors and observing what happens to their Context object. More...

Static Public Member Functions

static void main (String[] args)
 

Detailed Description

Duplicating processors and observing what happens to their Context object.

Author
Sylvain Hallé Easy

Definition at line 36 of file DuplicateContext.java.

Member Function Documentation

◆ main()

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

We first create an ApplyFunction that simply adds

Definition at line 38 of file DuplicateContext.java.

39  {
40  /// We first create an ApplyFunction that simply adds
41  // the value of some context element to the current event
42  ApplyFunction f1 = new ApplyFunction(new FunctionTree(
43  Numbers.addition, StreamVariable.X, new ContextVariable("foo")));
44  Connector.connect(f1, new Print()
45  .setPrefix("f1: ").setSeparator("\n"));
46 
47  // We then feed a few events to each of them
48  Pushable p_f1 = f1.getPushableInput();
49  f1.setContext("foo", 10);
50  p_f1.push(3).push(1);
51 
52  // Let us now duplicate sum1 and push events to the copy
53  ApplyFunction f2 = (ApplyFunction) f1.duplicate();
54  Connector.connect(f2, new Print()
55  .setPrefix("f2: ").setSeparator("\n"));
56  Pushable p_f2 = f2.getPushableInput();
57  p_f2.push(2).push(7).push(1);
58  ///
59  }

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