Class EdgeSegmentImpl

  • All Implemented Interfaces:
    Serializable, Comparable<EdgeSegment>, EdgeSegment
    Direct Known Subclasses:
    ConnectoidSegmentImpl, LinkSegmentImpl

    public abstract class EdgeSegmentImpl
    extends Object
    implements EdgeSegment
    EdgeSegment represents an edge in a particular (single) direction. Each edge has either one or two edge segments where each edge segment may have a more detailed geography than its parent link (which represents both directions via a centreline) This class is now abstract. It is extended by LinkSegment (physical links) and Connectoid (virtual links).
    Author:
    markr
    See Also:
    Serialized Form
    • Field Detail

      • id

        protected final long id
        unique internal identifier
      • parentEdge

        protected final Edge parentEdge
        segment's parent edge
      • upstreamVertex

        protected final Vertex upstreamVertex
        the upstreamVertex of the edge segment
      • downstreamVertex

        protected final Vertex downstreamVertex
        The downstream vertex of this edge segment
      • externalId

        protected Object externalId
        The external Id for this link segment type
    • Constructor Detail

      • EdgeSegmentImpl

        protected EdgeSegmentImpl​(IdGroupingToken groupId,
                                  Edge parentEdge,
                                  boolean directionAB)
        Constructor
        Parameters:
        groupId - contiguous id generation within this group for instances of this class
        parentEdge - parent edge of segment
        directionAB - direction of travel
    • Method Detail

      • generateEdgeSegmentId

        protected static int 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
      • getUpstreamVertex

        public Vertex getUpstreamVertex()
        Get the segment's upstream vertex
        Specified by:
        getUpstreamVertex in interface EdgeSegment
        Returns:
        upstream vertex
      • getDownstreamVertex

        public Vertex getDownstreamVertex()
        Get the segment's downstream vertex
        Specified by:
        getDownstreamVertex in interface EdgeSegment
        Returns:
        downstream vertex
      • getId

        public long getId()
        Unique id of the edge segment
        Specified by:
        getId in interface EdgeSegment
        Returns:
        id
      • getParentEdge

        public Edge getParentEdge()
        parent edge of the segment
        Specified by:
        getParentEdge in interface EdgeSegment
        Returns:
        parentEdge
      • setExternalId

        public void setExternalId​(Object externalId)
        set external id of the instance. Note that this id need not be unique (unlike regular id)
        Specified by:
        setExternalId in interface EdgeSegment
        Parameters:
        externalId - for the edge segment
      • hasExternalId

        public boolean hasExternalId()
        Does the instance have an external id
        Specified by:
        hasExternalId in interface EdgeSegment
        Returns:
        true when available, false otherwise
      • getExternalId

        public Object getExternalId()
        Get external id of the instance. Note that this id need not be unique (unlike regular id)
        Specified by:
        getExternalId in interface EdgeSegment
        Returns:
        externalId