quarks.graph

Interface Graph

  • All Known Implementing Classes:
    quarks.graph.spi.AbstractGraph, DirectGraph


    public interface Graph
    A generic directed graph of vertices, connectors and edges.

    The graph consists of Vertex objects, each having 0 or more input and/or output Connector objects. Edge objects connect an output connector to an input connector.

    A vertex has an associated Oplet instance that will be executed at runtime.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      java.util.Collection<Edge> getEdges()
      Return an unmodifiable view of all edges in this graph.
      java.util.Collection<Vertex<? extends Oplet<?,?>,?,?>> getVertices()
      Return an unmodifiable view of all vertices in this graph.
      <N extends Oplet<C,P>,C,P>
      Vertex<N,C,P>
      insert(N oplet, int inputs, int outputs)
      Add a new unconnected Vertex into the graph.
      void peekAll(Supplier<? extends Peek<?>> supplier, Predicate<Vertex<?,?,?>> select)
      Insert Peek oplets returned by the specified Supplier into the outputs of all of the oplets which satisfy the specified Predicate.
      <N extends Oplet<C,P>,C,P>
      Connector<P>
      pipe(Connector<C> output, N oplet)
      Create a new connected Vertex associated with the specified Oplet.
      <N extends Source<P>,P>
      Connector<P>
      source(N oplet)
      Create a new unconnected Vertex associated with the specified source Oplet.
    • Method Detail

      • insert

        <N extends Oplet<C,P>,C,P> Vertex<N,C,P> insert(N oplet,
                                                        int inputs,
                                                        int outputs)
        Add a new unconnected Vertex into the graph.

        Parameters:
        oplet - the oplet to associate with the new vertex
        inputs - the number of input connectors for the new vertex
        outputs - the number of output connectors for the new vertex
        Returns:
        the newly created Vertex for the oplet
      • source

        <N extends Source<P>,P> Connector<P> source(N oplet)
        Create a new unconnected Vertex associated with the specified source Oplet.

        The Vertex for the oplet has 0 input connectors and one output connector.

        Parameters:
        oplet - the source oplet
        Returns:
        the output connector for the newly created vertex.
      • pipe

        <N extends Oplet<C,P>,C,P> Connector<P> pipe(Connector<C> output,
                                                     N oplet)
        Create a new connected Vertex associated with the specified Oplet.

        The new Vertex has one input and one output Connector. An Edge is created connecting the specified output connector to the new vertice's input connector.

        Parameters:
        output -
        oplet - the oplet to associate with the new Vertex
        Returns:
        the output connector for the new Vertex
      • peekAll

        void peekAll(Supplier<? extends Peek<?>> supplier,
                     Predicate<Vertex<?,?,?>> select)
        Insert Peek oplets returned by the specified Supplier into the outputs of all of the oplets which satisfy the specified Predicate.
        Parameters:
        supplier - Function which provides a Peek oplet to insert
        select - Predicate to determine determines whether a Peek oplet will be inserted on the outputs of the vertex passed as parameter
      • getVertices

        java.util.Collection<Vertex<? extends Oplet<?,?>,?,?>> getVertices()
        Return an unmodifiable view of all vertices in this graph.
        Returns:
        unmodifiable view of all vertices in this graph
      • getEdges

        java.util.Collection<Edge> getEdges()
        Return an unmodifiable view of all edges in this graph.

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