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

  • Type Parameters:
    V - type of vertex
    E - type of edge
    All Implemented Interfaces:
    Edge<V>, Path<V,​E>

    public class DisjointPathPair<V extends Vertex,​E extends Edge<V>>
    extends Object
    implements Path<V,​E>
    Pair of disjoint paths.
    • Constructor Detail

      • DisjointPathPair

        public DisjointPathPair​(Path<V,​E> primary,
                                Path<V,​E> secondary)
        Creates a disjoint path pair from two paths.
        Parameters:
        primary - primary path
        secondary - secondary path
    • Method Detail

      • src

        public V src()
        Description copied from interface: Edge
        Returns the edge source vertex.
        Specified by:
        src in interface Edge<V extends Vertex>
        Returns:
        source vertex
      • dst

        public V dst()
        Description copied from interface: Edge
        Returns the edge destination vertex.
        Specified by:
        dst in interface Edge<V extends Vertex>
        Returns:
        destination vertex
      • primary

        public Path<V,​E> primary()
        Returns the primary path.
        Returns:
        primary path
      • secondary

        public Path<V,​E> secondary()
        Returns the secondary path.
        Returns:
        secondary path, or null if there is no secondary path available.
      • cost

        public Weight cost()
        Description copied from interface: Path
        Returns the total cost of the path as a weight object.
        Specified by:
        cost in interface Path<V extends Vertex,​E extends Edge<V>>
        Returns:
        path cost as a weight object
      • edges

        public List<E> edges()
        Description copied from interface: Path
        Returns the list of edges comprising the path. Adjacent edges will share the same vertex, meaning that a source of one edge, will be the same as the destination of the prior edge.
        Specified by:
        edges in interface Path<V extends Vertex,​E extends Edge<V>>
        Returns:
        list of path edges
      • hasBackup

        public boolean hasBackup()
        Checks if this path pair contains a backup/secondary path.
        Returns:
        boolean representing whether it has backup
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • size

        public int size()
        Returns number of paths inside this path pair object.
        Returns:
        number of paths