quarks.graph

Interface Connector<T>

  • Type Parameters:
    T - Type of the data item produced by the output port


    public interface Connector<T>
    A Connector represents an output port of a Vertex. A Connector supports two methods to add processing for tuples submitted to the port:
    • connect(Vertex, int) : Connect this to an input port of another Vertex. 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 tuple t 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 by connect(Vertex, int). Multiple peeks can be inserted. A tuple t 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 this Connector with the t being seen first by the first peek added.
    For example with peeks P1,P2,P3 added in that order and connections C1,C2 added, the graph will be logically:
     
                          -->C1
     port-->P1-->P2-->P3--|
                          -->C2
     
     
    A tuple t submitted by the port will be peeked at by P1, then P2 then P3. After P3 peeked at the tuple, C1 and C2 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 this Connector 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 the Graph for this Connector.
      boolean isConnected()
      Is my output port connected to any input port.
      <N extends Peek<T>>
      Connector<T>
      peek(N oplet)
      Inserts a Peek 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 the Graph for this Connector.
        Returns:
        the Graph for this Connector.
      • connect

        void connect(Vertex<?,T,?> target,
                     int inputPort)
        Connect this Connector 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 - the Vertex to connect to
        inputPort - 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 a Peek 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.

Copyright IBM 2015,2016 - 2f6ad0e-20160307-0902