Class DAGBuilder<V extends Vertex,​E extends Edge<V>>

    • Constructor Detail

      • DAGBuilder

        public DAGBuilder()
        Constructor of DAGBuilder: it initializes everything.
      • DAGBuilder

        public DAGBuilder​(DAG<V,​E> dag)
        Constructor of DAGBuilder with a DAG to start from.
        Parameters:
        dag - to start the builder from.
    • Method Detail

      • addVertex

        public DAGBuilder<V,​E> addVertex​(V v)
        Add vertex to the builder.
        Parameters:
        v - vertex to add.
        Returns:
        the builder.
      • addVertex

        public DAGBuilder<V,​E> addVertex​(V v,
                                               Stack<LoopVertex> loopVertexStack)
        Add vertex to the builder, using the LoopVertex stack.
        Parameters:
        v - vertex to add.
        loopVertexStack - LoopVertex stack to retrieve the information from.
        Returns:
        the builder.
      • addVertex

        public DAGBuilder<V,​E> addVertex​(V v,
                                               DAG<V,​E> dag)
        Add vertex to the builder, using the information from the given DAG.
        Parameters:
        v - vertex to add.
        dag - DAG to observe and get the LoopVertex-related information from.
        Returns:
        the builder.
      • removeVertex

        public DAGBuilder<V,​E> removeVertex​(V v)
        Remove the vertex from the list.
        Parameters:
        v - vertex to remove.
        Returns:
        the builder.
      • connectVertices

        public DAGBuilder<V,​E> connectVertices​(E edge)
        Connect vertices at the edge.
        Parameters:
        edge - edge to add. Note: the two vertices of the edge should already be added to the DAGBuilder.
        Returns:
        the builder.
      • isEmpty

        public boolean isEmpty()
        Checks whether the DAGBuilder is empty.
        Returns:
        whether the DAGBuilder is empty or not.
      • contains

        public boolean contains​(V vertex)
        check if the DAGBuilder contains the vertex.
        Parameters:
        vertex - vertex that it searches for.
        Returns:
        whether or not the builder contains it.
      • contains

        public boolean contains​(Predicate<V> predicate)
        check if the DAGBuilder contains any vertex that satisfies the predicate.
        Parameters:
        predicate - predicate to test each vertices with.
        Returns:
        whether or not the builder contains it.
      • buildWithoutSourceSinkCheck

        public DAG<V,​E> buildWithoutSourceSinkCheck()
        Build the DAG without source and sink check.
        Returns:
        the DAG contained by the builder.
      • buildWithoutSourceCheck

        public DAG<V,​E> buildWithoutSourceCheck()
        Build the DAG without source check.
        Returns:
        the DAG contained by the builder.
      • build

        public DAG<V,​E> build()
        Build the DAG.
        Returns:
        the DAG contained by the builder.