Code Examples
A repository of 155 code examples for BeepBeep
Package functions

Create custom Function objects, directly or by combining existing functions. More...

Packages

package  custom
 

Classes

class  AddNumbers
 Add two numbers with the Addition function. More...
 
class  ConstantUsage
 Basic usage of the ca.uqac.lif.cep.functions.Constant function. More...
 
class  CumulateAnd
 Use a cumulative processor to perform the conjunction of a stream of Boolean values. More...
 
class  FixedInterval
 Creates a compound function (a FunctionTree) that checks if a number lies between two fixed bounds. More...
 
class  FunctionBinary
 Apply a binary function on an input stream using the ApplyFunction processor. More...
 
class  FunctionChain
 Pipe multiple ApplyFunction processors to perform a more complex computation over a stream. More...
 
class  FunctionTreeUsage
 Use a FunctionTree to create a complex function. More...
 
class  FunctionUsage
 Show the basic usage of Function objects. More...
 
class  Interval
 Creates a compound function (a FunctionTree) that checks if a number lies between two other numbers. More...
 
class  IsPrime
 Create a custom unary function that checks if a number is prime. More...
 
class  Maximum
 Binary function that returns the maximum of two values. More...
 
class  PlaceholderUsage
 Use the ArgumentPlaceholder function to refer to the i-th argument of a function. More...
 
class  Polynomial
 Use an StreamVariable and a FunctionTree to create the polynomial function x2+3. More...
 

Detailed Description

Create custom Function objects, directly or by combining existing functions.

A particular aspect of BeepBeep 3 is the fact that functions are themselves objects. For example, the ApplyFunction applies a function (any function) to each incoming event. The actual function that it uses is chosen by passing to this processor a Function object.

BeepBeep and its supplemental palettes already define plenty of functions for specific uses. However, if no function suits your needs, it also provides simple means for creating your own function objects. This can be done in two ways:

  • By creating a new class that inherits from Function or one of its descendents
  • By combining (i.e. composing) existing functions in an expression. For example, the function f(x,y) = 2x + y is a function of two arguments, defined by composing existing functions, namely multiplication and addition. In BeepBeep, writing such an expression is done by creating an instance of a FunctionTreeUsage.
Author
Sylvain Hallé