Class LinkSegmentBase<L extends Link>
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.graph.GraphEntityImpl
-
- org.goplanit.graph.directed.EdgeSegmentImpl<L>
-
- org.goplanit.network.layer.physical.LinkSegmentBase<L>
-
- All Implemented Interfaces:
Serializable
,Comparable<IdAble>
,EdgeSegment
,GraphEntity
,ExternalIdAble
,IdAble
,ManagedId
,LinkSegment
- Direct Known Subclasses:
MacroscopicLinkSegmentImpl
public abstract class LinkSegmentBase<L extends Link> extends EdgeSegmentImpl<L> 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.directed.EdgeSegment
EDGE_SEGMENT_ID_CLASS, getDownstreamVertex, getUpstreamVertex
-
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
LinkSegmentBase(LinkSegmentBase<L> other, boolean deepCopy)
Copy constructorprotected
LinkSegmentBase(IdGroupingToken groupId, boolean directionAB)
Constructorprotected
LinkSegmentBase(IdGroupingToken groupId, L parentLink, boolean directionAB)
Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract LinkSegmentBase<L>
deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call.Node
getDownstreamVertex()
Get the segment's downstream vertexlong
getLinkSegmentId()
Return id of this instance.int
getNumberOfLanes()
Collect the number of lanes of this segmentL
getParent()
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 idLinkSegment
setNumberOfLanes(int numberOfLanes)
Set the number of lanesLinkSegment
setPhysicalSpeedLimitKmH(double maximumSpeed)
This is the maximum speed that is physically present and a driver can observe from the signs on the road (km/h)abstract LinkSegmentBase<L>
shallowClone()
Create a shallow copy of this entity-
Methods inherited from class org.goplanit.graph.directed.EdgeSegmentImpl
isDirectionAb, removeParentEdge, setParent, validate, 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
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.graph.directed.EdgeSegment
getIdClass, getLengthKm, getOppositeDirectionSegment, getParentName, hasGeometry, hasParent, hasParentName, isAdjacent, isDirectionAb, isParentGeometryInSegmentDirection, removeParentEdge, setParent, validate
-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
appendExternalId, appendExternalId, getExternalId, getIdsAsString, getSplitExternalId, getSplitExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId, 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
generateLinkSegmentId, getAllowedModes, getAllowedModesFrom, getDownstreamNode, getLinkSegmentIdClass, getParentLink, getUpstreamNode, hasNode, isDownstreamNode, isModeAllowed, isUpstreamNode
-
Methods inherited from interface org.goplanit.utils.id.ManagedId
resetChildManagedIdEntities
-
-
-
-
Constructor Detail
-
LinkSegmentBase
protected LinkSegmentBase(IdGroupingToken groupId, boolean directionAB)
Constructor- Parameters:
groupId
- , contiguous id generation within this group for instances of this classdirectionAB
- direction of travel
-
LinkSegmentBase
protected LinkSegmentBase(IdGroupingToken groupId, L parentLink, boolean directionAB)
Constructor- Parameters:
groupId
- , contiguous id generation within this group for instances of this classparentLink
- parent link of segmentdirectionAB
- direction of travel
-
LinkSegmentBase
protected LinkSegmentBase(LinkSegmentBase<L> other, boolean deepCopy)
Copy constructor- Parameters:
other
- to copydeepCopy
- when true, create a deep copy, shallow copy otherwise
-
-
Method Detail
-
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 (may be null in case managed id entity does not rely on token to recreate its managed id(s))- 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
-
getParent
public L getParent()
Collect the parent edge of the segment- Specified by:
getParent
in interfaceEdgeSegment
- Specified by:
getParent
in interfaceLinkSegment
- Overrides:
getParent
in classEdgeSegmentImpl<L extends Link>
- Returns:
- parentEdge
-
getDownstreamVertex
public Node getDownstreamVertex()
Get the segment's downstream vertex- Specified by:
getDownstreamVertex
in interfaceEdgeSegment
- Specified by:
getDownstreamVertex
in interfaceLinkSegment
- Returns:
- downstream vertex
-
getUpstreamVertex
public Node getUpstreamVertex()
Get the segment's upstream vertex- Specified by:
getUpstreamVertex
in interfaceEdgeSegment
- Specified by:
getUpstreamVertex
in interfaceLinkSegment
- 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 LinkSegment setNumberOfLanes(int numberOfLanes)
Set the number of lanes- Specified by:
setNumberOfLanes
in interfaceLinkSegment
- Parameters:
numberOfLanes
- to set- Returns:
- this link segment
-
setPhysicalSpeedLimitKmH
public LinkSegment setPhysicalSpeedLimitKmH(double maximumSpeed)
This is the maximum speed that is physically present and a driver can observe from the signs on the road (km/h)- Specified by:
setPhysicalSpeedLimitKmH
in interfaceLinkSegment
- Parameters:
maximumSpeed
- to set- Returns:
- this linkSegment
-
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
-
shallowClone
public abstract LinkSegmentBase<L> shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClone
in interfaceEdgeSegment
- Specified by:
shallowClone
in interfaceGraphEntity
- Specified by:
shallowClone
in interfaceIdAble
- Specified by:
shallowClone
in interfaceLinkSegment
- Overrides:
shallowClone
in classEdgeSegmentImpl<L extends Link>
- Returns:
- shallow copy of entity
-
deepClone
public abstract LinkSegmentBase<L> deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call. To be used with caution if not called by managed id container related code- Specified by:
deepClone
in interfaceEdgeSegment
- Specified by:
deepClone
in interfaceGraphEntity
- Specified by:
deepClone
in interfaceIdAble
- Specified by:
deepClone
in interfaceLinkSegment
- Overrides:
deepClone
in classEdgeSegmentImpl<L extends Link>
- Returns:
- deep copy of entity
-
-