Class LinkSegmentImpl
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.graph.GraphEntityImpl
-
- org.goplanit.graph.directed.EdgeSegmentImpl
-
- org.goplanit.network.layer.physical.LinkSegmentImpl
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<IdAble>
,EdgeSegment
,GraphEntity
,ExternalIdAble
,IdAble
,ManagedId
,LinkSegment
- Direct Known Subclasses:
MacroscopicLinkSegmentImpl
public class LinkSegmentImpl extends EdgeSegmentImpl implements LinkSegment
Link segment object representing physical links in the network and storing their properties- Author:
- gman6028, markr
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected long
linkSegmentId
unique internal identifierprotected int
numberOfLanes
segment's number of lanesprotected double
physicalSpeedLinkKmh
physical maximum speed on the link segment in km/h-
Fields inherited from interface org.goplanit.utils.graph.EdgeSegment
EDGE_SEGMENT_ID_CLASS
-
Fields inherited from interface org.goplanit.utils.network.layer.physical.LinkSegment
DEFAULT_MAX_SPEED, DEFAULT_NUMBER_OF_LANES, LINK_SEGMENT_ID_CLASS, MAXIMUM_DENSITY
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
LinkSegmentImpl(LinkSegmentImpl linkSegmentImpl)
Copy constructorprotected
LinkSegmentImpl(IdGroupingToken groupId, boolean directionAB)
Constructorprotected
LinkSegmentImpl(IdGroupingToken groupId, Link parentLink, boolean directionAB)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LinkSegmentImpl
clone()
Create a shallow copy of this entityprotected static long
generateLinkSegmentId(IdGroupingToken groupId)
Generate unique link segment idNode
getDownstreamVertex()
Get the segment's downstream vertexlong
getLinkSegmentId()
Return id of this instance.int
getNumberOfLanes()
Collect the number of lanes of this segmentLink
getParentEdge()
Collect the parent edge of the segmentdouble
getPhysicalSpeedLimitKmH()
This is the maximum speed that is physically present and a driver can observe from the signs on the roadNode
getUpstreamVertex()
Get the segment's upstream vertexprotected long
recreateLinkSegmentId(IdGroupingToken tokenId)
recreate the internal link segment id and set itlong
recreateManagedIds(IdGroupingToken tokenId)
Recreate internal ids: id and link segment idprotected void
setLinkSegmentId(long linkSegmentId)
Set the link segment idvoid
setNumberOfLanes(int numberOfLanes)
Set the number of lanesvoid
setPhysicalSpeedLimitKmH(double maximumSpeed)
This is the maximum speed that is physically present and a driver can observe from the signs on the road-
Methods inherited from class org.goplanit.graph.directed.EdgeSegmentImpl
isDirectionAb, remove, removeParentEdge, setDownstreamVertex, setParent, setUpstreamVertex, validate
-
Methods inherited from class org.goplanit.graph.GraphEntityImpl
generateAndSetId, generateId, toString
-
Methods inherited from class org.goplanit.utils.id.ExternalIdAbleImpl
getExternalId, getXmlId, setExternalId, setXmlId
-
Methods inherited from class org.goplanit.utils.id.IdAbleImpl
equals, generateAndSetId, getId, hashCode, setId
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.graph.EdgeSegment
getIdClass, getParentName, hasParentName, isDirectionAb, remove, removeParentEdge, replace, setDownstreamVertex, setParent, setUpstreamVertex, validate
-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
getExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, getId, idEquals, idHashCode
-
Methods inherited from interface org.goplanit.utils.network.layer.physical.LinkSegment
getDownstreamNode, getLinkSegmentIdClass, getParentLink, getUpstreamNode
-
Methods inherited from interface org.goplanit.utils.id.ManagedId
resetChildManagedIdEntities
-
-
-
-
Constructor Detail
-
LinkSegmentImpl
protected LinkSegmentImpl(IdGroupingToken groupId, boolean directionAB) throws PlanItException
Constructor- Parameters:
groupId
- , contiguous id generation within this group for instances of this classdirectionAB
- direction of travel- Throws:
PlanItException
- throw when error
-
LinkSegmentImpl
protected LinkSegmentImpl(IdGroupingToken groupId, Link parentLink, boolean directionAB) throws PlanItException
Constructor- Parameters:
groupId
- , contiguous id generation within this group for instances of this classparentLink
- parent link of segmentdirectionAB
- direction of travel- Throws:
PlanItException
- throw when error
-
LinkSegmentImpl
protected LinkSegmentImpl(LinkSegmentImpl linkSegmentImpl)
Copy constructor- Parameters:
linkSegmentImpl
- to copy
-
-
Method Detail
-
generateLinkSegmentId
protected static long generateLinkSegmentId(IdGroupingToken groupId)
Generate unique link segment id- Parameters:
groupId
- , contiguous id generation within this group for instances of this class- Returns:
- id of this link segment
-
setLinkSegmentId
protected void setLinkSegmentId(long linkSegmentId)
Set the link segment id- Parameters:
linkSegmentId
- to use
-
recreateLinkSegmentId
protected long recreateLinkSegmentId(IdGroupingToken tokenId)
recreate the internal link segment id and set it- Parameters:
tokenId
- to use- Returns:
- updated id
-
recreateManagedIds
public long recreateManagedIds(IdGroupingToken tokenId)
Recreate internal ids: id and link segment id- Specified by:
recreateManagedIds
in interfaceManagedId
- Overrides:
recreateManagedIds
in classGraphEntityImpl
- Parameters:
tokenId
- to use- Returns:
- recreated id
-
getLinkSegmentId
public long getLinkSegmentId()
Return id of this instance. This id is expected to be generated using the org.planit.utils.misc.IdGenerator- Specified by:
getLinkSegmentId
in interfaceLinkSegment
- Returns:
- link segment id
-
getParentEdge
public Link getParentEdge()
Collect the parent edge of the segment- Specified by:
getParentEdge
in interfaceEdgeSegment
- Specified by:
getParentEdge
in interfaceLinkSegment
- Overrides:
getParentEdge
in classEdgeSegmentImpl
- Returns:
- parentEdge
-
getDownstreamVertex
public Node getDownstreamVertex()
Get the segment's downstream vertex- Specified by:
getDownstreamVertex
in interfaceEdgeSegment
- Specified by:
getDownstreamVertex
in interfaceLinkSegment
- Overrides:
getDownstreamVertex
in classEdgeSegmentImpl
- Returns:
- downstream vertex
-
getUpstreamVertex
public Node getUpstreamVertex()
Get the segment's upstream vertex- Specified by:
getUpstreamVertex
in interfaceEdgeSegment
- Specified by:
getUpstreamVertex
in interfaceLinkSegment
- Overrides:
getUpstreamVertex
in classEdgeSegmentImpl
- Returns:
- upstream vertex
-
getNumberOfLanes
public int getNumberOfLanes()
Collect the number of lanes of this segment- Specified by:
getNumberOfLanes
in interfaceLinkSegment
- Returns:
- number of lanes
-
setNumberOfLanes
public void setNumberOfLanes(int numberOfLanes)
Set the number of lanes- Specified by:
setNumberOfLanes
in interfaceLinkSegment
- Parameters:
numberOfLanes
- to set
-
setPhysicalSpeedLimitKmH
public void setPhysicalSpeedLimitKmH(double maximumSpeed)
This is the maximum speed that is physically present and a driver can observe from the signs on the road- Specified by:
setPhysicalSpeedLimitKmH
in interfaceLinkSegment
- Parameters:
maximumSpeed
- physical speed limit
-
getPhysicalSpeedLimitKmH
public double getPhysicalSpeedLimitKmH()
This is the maximum speed that is physically present and a driver can observe from the signs on the road- Specified by:
getPhysicalSpeedLimitKmH
in interfaceLinkSegment
- Returns:
- maximumSpeed
-
clone
public LinkSegmentImpl clone()
Create a shallow copy of this entity- Specified by:
clone
in interfaceEdgeSegment
- Specified by:
clone
in interfaceIdAble
- Overrides:
clone
in classEdgeSegmentImpl
- Returns:
- shallow copy of entity
-
-