Package org.planit.graph
Class EdgeSegmentImpl
- java.lang.Object
-
- org.planit.graph.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 Summary
Fields Modifier and Type Field Description protected Vertex
downstreamVertex
The downstream vertex of this edge segmentprotected Object
externalId
The external Id for this link segment typeprotected long
id
unique internal identifierprotected Edge
parentEdge
segment's parent edgeprotected Vertex
upstreamVertex
the upstreamVertex of the edge segment
-
Constructor Summary
Constructors Modifier Constructor Description protected
EdgeSegmentImpl(IdGroupingToken groupId, Edge parentEdge, boolean directionAB)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(EdgeSegment o)
compare based on edge segment idprotected static int
generateEdgeSegmentId(IdGroupingToken groupId)
Generate unique edge segment idVertex
getDownstreamVertex()
Get the segment's downstream vertexObject
getExternalId()
Get external id of the instance.long
getId()
Unique id of the edge segmentEdge
getParentEdge()
parent edge of the segmentVertex
getUpstreamVertex()
Get the segment's upstream vertexboolean
hasExternalId()
Does the instance have an external idvoid
setExternalId(Object externalId)
set external id of the instance.
-
-
-
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 classparentEdge
- parent edge of segmentdirectionAB
- 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 interfaceEdgeSegment
- Returns:
- upstream vertex
-
getDownstreamVertex
public Vertex getDownstreamVertex()
Get the segment's downstream vertex- Specified by:
getDownstreamVertex
in interfaceEdgeSegment
- Returns:
- downstream vertex
-
getId
public long getId()
Unique id of the edge segment- Specified by:
getId
in interfaceEdgeSegment
- Returns:
- id
-
getParentEdge
public Edge getParentEdge()
parent edge of the segment- Specified by:
getParentEdge
in interfaceEdgeSegment
- 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 interfaceEdgeSegment
- Parameters:
externalId
- for the edge segment
-
hasExternalId
public boolean hasExternalId()
Does the instance have an external id- Specified by:
hasExternalId
in interfaceEdgeSegment
- 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 interfaceEdgeSegment
- Returns:
- externalId
-
compareTo
public int compareTo(EdgeSegment o)
compare based on edge segment id- Specified by:
compareTo
in interfaceComparable<EdgeSegment>
- See Also:
Comparable.compareTo(java.lang.Object)
-
-