quarks.graph
Interface Connector<T>
-
- Type Parameters:
T
- Type of the data item produced by the output port
public interface Connector<T>
AConnector
represents an output port of aVertex
. AConnector
supports two methods to add processing for tuples submitted to the port:connect(Vertex, int)
: Connect this to an input port of anotherVertex
. Any number of connections can be made. Any tuple submitted by the output port will appear on all connections made through this method. For any tuplet
ordering of appearance across the connected input ports is not guaranteed.peek(Peek)
: Insert a peek after the output port and before any connections made byconnect(Vertex, int)
. Multiple peeks can be inserted. A tuplet
submitted by the output port will be seen by all peek oplets. The ordering of the peek is guaranteed such that the peeks are processed in the order they were added to thisConnector
with thet
being seen first by the first peek added.
P1,P2,P3
added in that order and connectionsC1,C2
added, the graph will be logically:-->C1 port-->P1-->P2-->P3--| -->C2
t
submitted by the port will be peeked at byP1
, thenP2
thenP3
. AfterP3
peeked at the tuple,C1
andC2
will process the tuple in an arbitrary order.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description void
connect(Vertex<?,T,?> target, int inputPort)
Connect thisConnector
to the specified target's input.java.util.Set<java.lang.String>
getTags()
Returns the set of tags associated with this connector.Graph
graph()
Gets theGraph
for thisConnector
.boolean
isConnected()
Is my output port connected to any input port.<N extends Peek<T>>
Connector<T>peek(N oplet)
Inserts aPeek
oplet between an output port and its connections.void
tag(java.lang.String... values)
Adds the specified tags to the connector.
-
-
-
Method Detail
-
graph
Graph graph()
Gets theGraph
for thisConnector
.- Returns:
- the
Graph
for thisConnector
.
-
connect
void connect(Vertex<?,T,?> target, int inputPort)
Connect thisConnector
to the specified target's input. This method may be called multiple times to fan out to multiple input ports. Each tuple submitted to this output port will be processed by all connections.- Parameters:
target
- theVertex
to connect toinputPort
- the index of the target's input port to connect to.
-
isConnected
boolean isConnected()
Is my output port connected to any input port.- Returns:
- true if connected
-
peek
<N extends Peek<T>> Connector<T> peek(N oplet)
Inserts aPeek
oplet between an output port and its connections. This method may be called multiple times to insert multiple peeks. Each tuple submitted to this output port will be seen by all peeks in order of their insertion, starting with the first peek inserted.- Parameters:
oplet
- Oplet to insert.- Returns:
output
-
tag
void tag(java.lang.String... values)
Adds the specified tags to the connector. Adding the same tag multiple times will not change the result beyond the initial application. An unconnected connector can be tagged.- Parameters:
values
- Tag values.
-
getTags
java.util.Set<java.lang.String> getTags()
Returns the set of tags associated with this connector.- Returns:
- set of tag values.
-
-