0.11.4
ca.uqac.lif.cep.Connector Class Reference

Detailed Description

Provides a number of convenient methods for connecting the outputs of processors to the inputs of other processors.

Methods provided by the Connector class are called connect() and have various signatures. Their return value typically consists of the last processor of the chain given as an argument. This means that nested calls to connect() are possible to form a complex chain of processors in one pass, e.g.:

Processor p = Connector.connect(new QueueSource(2, 1),
    Connector.connect(new QueueSource(1, 1), new Addition(), 0, 0), 0, 1);

In the previous example, the inner call to connect() links output 0 of a QueueSource to input 0 of an Addition processor;

If you use lots of calls to Connector.connect, you may consider writing:

static import Connector.connect;

in the beginning of your file, so you can simply write connect instead of Connector.connect every time.

Author
Sylvain Hallé
Since
0.1

Definition at line 56 of file Connector.java.

Classes

class  ConnectorException
 Exception thrown when a problem occurs when attempting to connect two objects. More...
class  ConnectionException
 Exception thrown when a problem occurs when connecting the output pipe of a processor to the input pipe of another one. More...
class  IncompatibleTypesException
 Exception thrown when two processors with incompatible input/output types are attempted to be connected. More...
class  IndexOutOfBoundsException
 Exception thrown when the connector is asked to pipe something to a nonexistent input or output. More...
class  SelfLoopException
 Exception thrown when trying to connect the output of a processor to its own input. More...
class  Variant
 Empty class representing the fact that the output type of a processor may vary. More...
class  Connection
 Represents a connection between two pipes. More...
class  PipeSelector
 An object that holds a reference to a processor, and which can produce a SelectedPipe for a given index. More...
class  SelectedPipe
 An object that designates a specific input or output pipe for a specific processor. More...
class  SelectedInputPipe
class  SelectedOutputPipe

Static Public Member Functions

static Processor connect (EventTracker tracker, Processor p1, int i, Processor p2, int j)
 Connects the i-th output of p1 to the j-th input of p2 @endiliteral.

static Processor connect (Processor p1, int i, Processor p2, int j)
 Connects the i-th output of p1 to the j-th input of p2 @endiliteral.

static Processor connect (Processor ... procs)
 Connects a chain of processors, by associating the outputs of one to the inputs of the next.
static Processor connect (EventTracker tracker, Processor ... procs)
 Connects a chain of processors, by associating the outputs of one to the inputs of the next.
static boolean isCompatible (Processor p1, int i, Processor p2, int j)
 Checks if the i-th output of processor p1 has a declared type compatible with the j-th input of processor p2 @endiliteral.

static Collection< ConnectiongetConnections (Processor p)
 Returns the set of connections associated to a processor.

Static Public Attributes

static final boolean s_checkForTypes = true
 Whether the connector checks that the input-output types of the processor it connects are compatible.
static final boolean s_checkForBounds = false
 Whether the connector checks that the processors are connected using in/out indexes within the bounds of their arity.
static final int INPUT = 0
 Constant used to replace the value 0 when referring to a processor's unique input.
static final int OUTPUT = 0
 Constant used to replace the value 0 when referring to a processor's unique output.
static final int LEFT = 0
 Constant used to replace the value 0 when referring to a processor's first input or output.
static final int TOP = 0
 Constant used to replace the value 0 when referring to a processor's first input or output.
static final int RIGHT = 1
 Constant used to replace the value 1 when referring to a processor's first input or output.
static final int BOTTOM = 1
 Constant used to replace the value 1 when referring to a processor's first input or output.

Static Protected Member Functions

static void checkForException (Processor p1, int i, Processor p2, int j)
 Checks if the i-th output of processor p1 has a declared type compatible with the j-th input of processor p2, and throws an appropriate exception if not.

Member Function Documentation

◆ checkForException()

void ca.uqac.lif.cep.Connector.checkForException ( Processor p1,
int i,
Processor p2,
int j )
staticprotected

Checks if the i-th output of processor p1 has a declared type compatible with the j-th input of processor p2, and throws an appropriate exception if not.

Parameters
p1The first processor
iThe index of the output on the first processor
p2The second processor
jThe index of the input on the second processor

Definition at line 289 of file Connector.java.

◆ connect() [1/4]

Processor ca.uqac.lif.cep.Connector.connect ( EventTracker tracker,
Processor ... procs )
static

Connects a chain of processors, by associating the outputs of one to the inputs of the next.

The output arity of the first must match that input arity of the next one. In the case the arity is greater than 1, the i-th output is linked to the i-th input.

Parameters
trackerThe EventTracker
procsThe list of processors
Returns
The last processor of the chain

Definition at line 226 of file Connector.java.

◆ connect() [2/4]

Processor ca.uqac.lif.cep.Connector.connect ( EventTracker tracker,
Processor p1,
int i,
Processor p2,
int j )
static

Connects the i-th output of p1 to the j-th input of p2 @endiliteral.

Parameters
trackerAn event tracker (optional)
p1The first processor
iThe output number of the first processor
p2The second processor
jThe input number of the second processor
Returns
A reference to processor p2

Definition at line 130 of file Connector.java.

◆ connect() [3/4]

Processor ca.uqac.lif.cep.Connector.connect ( Processor ... procs)
static

Connects a chain of processors, by associating the outputs of one to the inputs of the next.

The output arity of the first must match that input arity of the next one. In the case the arity is greater than 1, the i-th output is linked to the i-th input.

Parameters
procsThe list of processors
Returns
The last processor of the chain

Definition at line 209 of file Connector.java.

◆ connect() [4/4]

Processor ca.uqac.lif.cep.Connector.connect ( Processor p1,
int i,
Processor p2,
int j )
static

Connects the i-th output of p1 to the j-th input of p2 @endiliteral.

Parameters
p1The first processor
p2The second processor
iThe output number of the first processor
jThe input number of the second processor
Returns
A reference to processor p2

Definition at line 194 of file Connector.java.

◆ getConnections()

Collection< Connection > ca.uqac.lif.cep.Connector.getConnections ( Processor p)
static

Returns the set of connections associated to a processor.

Parameters
pThe processor
Returns
The set of collections
Since
0.10.2

Definition at line 342 of file Connector.java.

◆ isCompatible()

boolean ca.uqac.lif.cep.Connector.isCompatible ( Processor p1,
int i,
Processor p2,
int j )
static

Checks if the i-th output of processor p1 has a declared type compatible with the j-th input of processor p2 @endiliteral.

Parameters
p1The first processor
iThe index of the output on the first processor
p2The second processor
jThe index of the input on the second processor
Returns
true if the types are compatible, false otherwise

Definition at line 261 of file Connector.java.

Member Data Documentation

◆ BOTTOM

final int ca.uqac.lif.cep.Connector.BOTTOM = 1
static

Constant used to replace the value 1 when referring to a processor's first input or output.

Definition at line 104 of file Connector.java.

◆ INPUT

final int ca.uqac.lif.cep.Connector.INPUT = 0
static

Constant used to replace the value 0 when referring to a processor's unique input.

Definition at line 74 of file Connector.java.

◆ LEFT

final int ca.uqac.lif.cep.Connector.LEFT = 0
static

Constant used to replace the value 0 when referring to a processor's first input or output.

Definition at line 86 of file Connector.java.

◆ OUTPUT

final int ca.uqac.lif.cep.Connector.OUTPUT = 0
static

Constant used to replace the value 0 when referring to a processor's unique output.

Definition at line 80 of file Connector.java.

◆ RIGHT

final int ca.uqac.lif.cep.Connector.RIGHT = 1
static

Constant used to replace the value 1 when referring to a processor's first input or output.

Definition at line 98 of file Connector.java.

◆ s_checkForBounds

final boolean ca.uqac.lif.cep.Connector.s_checkForBounds = false
static

Whether the connector checks that the processors are connected using in/out indexes within the bounds of their arity.

Definition at line 68 of file Connector.java.

◆ s_checkForTypes

final boolean ca.uqac.lif.cep.Connector.s_checkForTypes = true
static

Whether the connector checks that the input-output types of the processor it connects are compatible.

Definition at line 62 of file Connector.java.

◆ TOP

final int ca.uqac.lif.cep.Connector.TOP = 0
static

Constant used to replace the value 0 when referring to a processor's first input or output.

Definition at line 92 of file Connector.java.


The documentation for this class was generated from the following file:
  • /home/sylvain/Workspaces/beepbeep/core/src/ca/uqac/lif/cep/Connector.java