Class EdgeSegmentImpl

    • Field Detail

      • xmlId

        protected String xmlId
        Xml Id of the edge segment
    • Constructor Detail

      • EdgeSegmentImpl

        protected EdgeSegmentImpl​(IdGroupingToken groupId,
                                  DirectedEdge parentEdge,
                                  boolean directionAB)
                           throws PlanItException
        Constructor
        Parameters:
        groupId - contiguous id generation within this group for instances of this class
        parentEdge - parent edge of segment
        directionAB - direction of travel
        Throws:
        PlanItException - thrown when parent edge's vertices are incompatible with directional edge segments
      • EdgeSegmentImpl

        protected EdgeSegmentImpl​(EdgeSegmentImpl edgeSegmentImpl)
        Copy constructor
        Parameters:
        edgeSegmentImpl - to copy
    • Method Detail

      • generateEdgeSegmentId

        protected static long generateEdgeSegmentId​(IdGroupingToken groupId)
        Generate unique edge segment id
        Parameters:
        groupId - contiguous id generation within this group for instances of this class
        Returns:
        id id of this EdgeSegment
      • setId

        protected void setId​(Long id)
        set id of edge segment
        Parameters:
        id - to set
      • hashCode

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

        public boolean remove​(DirectedVertex vertex)
        Remove the vertex from the edge segment if it is either the up or downstream vertex
        Specified by:
        remove in interface EdgeSegment
        Parameters:
        vertex - to remove
        Returns:
        true when successful, false otherwise
      • setDownstreamVertex

        public void setDownstreamVertex​(DirectedVertex downstreamVertex)
        Set another downstream vertex.
        Specified by:
        setDownstreamVertex in interface EdgeSegment
        Parameters:
        downstreamVertex - to use
      • setUpstreamVertex

        public void setUpstreamVertex​(DirectedVertex upstreamVertex)
        Set another upstream vertex.
        Specified by:
        setUpstreamVertex in interface EdgeSegment
        Parameters:
        upstreamVertex - to use
      • isDirectionAb

        public boolean isDirectionAb()
        check if edge segment runs from vertex a to b or b to a
        Specified by:
        isDirectionAb in interface EdgeSegment
        Returns:
        true when running from a to b, otherwise false
      • getId

        public long getId()
        collect id of the entity
        Specified by:
        getId in interface Idable
        Returns:
        id
      • removeParentEdge

        public void removeParentEdge()
        remove the parent edge from this edge segment
        Specified by:
        removeParentEdge in interface EdgeSegment
      • validate

        public boolean validate()
        validate the contents of this edge segment
        Specified by:
        validate in interface EdgeSegment
        Returns:
        true when valid, false otherwise
      • setExternalId

        public void setExternalId​(String externalId)
        set the external id
        Specified by:
        setExternalId in interface ExternalIdable
        Parameters:
        externalId - to set
      • getXmlId

        public String getXmlId()
        the id exposed to users as the "normal" id in the PLANit native xml format
        Specified by:
        getXmlId in interface ExternalIdable
        Returns:
        xmlId
      • setXmlId

        public void setXmlId​(String xmlId)
        set the external id
        Specified by:
        setXmlId in interface ExternalIdable
        Parameters:
        xmlId - to set