![]() |
0.11.4
|
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.
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< Connection > | getConnections (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. | |
|
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.
| p1 | The first processor |
| i | The index of the output on the first processor |
| p2 | The second processor |
| j | The index of the input on the second processor |
Definition at line 289 of file Connector.java.
|
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.
| tracker | The EventTracker |
| procs | The list of processors |
Definition at line 226 of file Connector.java.
|
static |
Connects the i-th output of p1 to the j-th input of p2 @endiliteral.
| tracker | An event tracker (optional) |
| p1 | The first processor |
| i | The output number of the first processor |
| p2 | The second processor |
| j | The input number of the second processor |
Definition at line 130 of file Connector.java.
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.
| procs | The list of processors |
Definition at line 209 of file Connector.java.
Connects the i-th output of p1 to the j-th input of p2 @endiliteral.
| p1 | The first processor |
| p2 | The second processor |
| i | The output number of the first processor |
| j | The input number of the second processor |
Definition at line 194 of file Connector.java.
|
static |
Returns the set of connections associated to a processor.
| p | The processor |
Definition at line 342 of file Connector.java.
Checks if the i-th output of processor p1 has a declared type compatible with the j-th input of processor p2 @endiliteral.
| p1 | The first processor |
| i | The index of the output on the first processor |
| p2 | The second processor |
| j | The index of the input on the second processor |
Definition at line 261 of file Connector.java.
|
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.
|
static |
Constant used to replace the value 0 when referring to a processor's unique input.
Definition at line 74 of file Connector.java.
|
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.
|
static |
Constant used to replace the value 0 when referring to a processor's unique output.
Definition at line 80 of file Connector.java.
|
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.
|
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.
|
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.
|
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.