Interface Edges<E extends Edge>

  • All Superinterfaces:
    Iterable<E>
    All Known Subinterfaces:
    Links<L>
    All Known Implementing Classes:
    EdgesImpl, LinksImpl

    public interface Edges<E extends Edge>
    extends Iterable<E>
    Container and factory class for edges in a graph, also to be used to create and register edges of any (derived) type
    Author:
    markr
    • Method Detail

      • remove

        void remove​(E edge)
        remove an edge.
        Parameters:
        edge - to remove
      • remove

        void remove​(long edgeId)
        remove an edge.
        Parameters:
        edgeId - of the edge to remove
      • registerNew

        default E registerNew​(Vertex vertexA,
                              Vertex vertexB,
                              double length)
                       throws PlanItException
        Create new edge to graph identified via its id, (not registered on vertices)
        Parameters:
        vertexA - the first vertex of this edge
        vertexB - the second vertex of this edge
        length - the length (in km)
        Returns:
        the created edge
        Throws:
        PlanItException - thrown if there is an error
      • registerNew

        E registerNew​(Vertex vertexA,
                      Vertex vertexB,
                      double length,
                      boolean registerOnVertices)
               throws PlanItException
        Create new edge to network identified via its id, allow to be registered on vertices if indicated)
        Parameters:
        vertexA - the first vertex in this edge
        vertexB - the second certex in this edge
        length - the length of this edge
        registerOnVertices - choice to register new edge on the vertices or not
        Returns:
        the created edge
        Throws:
        PlanItException - thrown if there is an error
      • registerUniqueCopyOf

        E registerUniqueCopyOf​(E edgeToCopy)
        copy the passed in edge and register it
        Parameters:
        edgeToCopy - as is except for its ids which will be updated to makeit uniquely identifiable
        Returns:
        copy of edge now registered
      • get

        E get​(long id)
        Get edge by id
        Parameters:
        id - the id of the edge
        Returns:
        the retrieved edge, null if not present
      • size

        int size()
        Get the number of edges in the graph
        Returns:
        the number of edges in the graph
      • isEmpty

        boolean isEmpty()
        Check if is empty
        Returns:
        true when no edges, false otherwise