Class EdgeSegmentsImpl<ES extends EdgeSegment>

    • Method Detail

      • updateIdMapping

        protected void updateIdMapping()
        updates the edge segments map keys based on edge segment ids in case an external force has changed already registered edges
      • register

        public void register​(ES edgeSegment)
        Register an edge segment. Use cautiously, Only register via a factory method to ensure correct id generation within the container
        Parameters:
        edgeSegment - the link segment to be registered
      • remove

        public void remove​(ES edgeSegment)
        Remove an edges segment
        Specified by:
        remove in interface EdgeSegments<ES extends EdgeSegment>
        Parameters:
        edgeSegment - to remove
      • remove

        public void remove​(long edgeSegmentId)
        Remove an edge segment by id
        Specified by:
        remove in interface EdgeSegments<ES extends EdgeSegment>
        Parameters:
        edgeSegmentId - to remove by id
      • create

        public ES create​(DirectedEdge parentEdge,
                         boolean directionAB)
                  throws PlanItException
        Create edge segment
        Specified by:
        create in interface EdgeSegments<ES extends EdgeSegment>
        Parameters:
        parentEdge - the parent edge of this edge segment
        directionAB - direction of travel
        Returns:
        the created edge segment
        Throws:
        PlanItException - thrown if there is an error
      • register

        public void register​(DirectedEdge parentEdge,
                             ES edgeSegment,
                             boolean directionAB)
                      throws PlanItException
        Register a edge segment (not registered on nodes and edge)
        Specified by:
        register in interface EdgeSegments<ES extends EdgeSegment>
        Parameters:
        parentEdge - the parent edge which specified edge segment will be registered on
        edgeSegment - edge segment to be registered
        directionAB - direction of travel
        Throws:
        PlanItException - thrown if there is an error
      • registerNew

        public ES registerNew​(DirectedEdge parentEdge,
                              boolean directionAb,
                              boolean registerOnNodeAndLink)
                       throws PlanItException
        Create directional edge segment and register it
        Specified by:
        registerNew in interface EdgeSegments<ES extends EdgeSegment>
        Parameters:
        parentEdge - the parent edge of this edge segment
        directionAb - direction of travel
        registerOnNodeAndLink - option to register the new edge segment on the underlying edge and its vertices
        Returns:
        the created edge segment
        Throws:
        PlanItException - thrown if there is an error
      • get

        public ES get​(long id)
        Get edge segment by id
        Specified by:
        get in interface EdgeSegments<ES extends EdgeSegment>
        Parameters:
        id - id of the edge segment
        Returns:
        retrieved edge Segment
      • getByXmlId

        public ES getByXmlId​(String xmlId)
        Return an edge segment by its Xml id Note: not an efficient implementation since it loops over all edge segments in linear time to identify the correct one, preferably use get instead whenever possible.
        Specified by:
        getByXmlId in interface EdgeSegments<ES extends EdgeSegment>
        Parameters:
        xmlId - the XML id of the edge segment
        Returns:
        the specified edge segment instance
      • size

        public long size()
        Return number of registered edge segments
        Specified by:
        size in interface EdgeSegments<ES extends EdgeSegment>
        Returns:
        number of registered edge segments
      • registerUniqueCopyOf

        public ES registerUniqueCopyOf​(ES edgeSegmentToCopy,
                                       DirectedEdge newParentEdge)
        copy the passed in edge segment and register it.
        Specified by:
        registerUniqueCopyOf in interface EdgeSegments<ES extends EdgeSegment>
        Parameters:
        edgeSegmentToCopy - as is except for its ids which will be updated to make it uniquely identifiable
        newParentEdge - update the parent edge to passed in edge
        Returns:
        copy of edge segment now registered