Package org.planit.network.physical
Class LinkSegmentImpl
- java.lang.Object
-
- org.planit.graph.EdgeSegmentImpl
-
- org.planit.network.physical.LinkSegmentImpl
-
- All Implemented Interfaces:
Serializable
,Comparable<EdgeSegment>
,EdgeSegment
,LinkSegment
- Direct Known Subclasses:
MacroscopicLinkSegmentImpl
public abstract 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 Map<Mode,Double>
maximumSpeedMap
Map of maximum speeds along this link for each modeprotected int
numberOfLanes
segment's number of lanes-
Fields inherited from class org.planit.graph.EdgeSegmentImpl
downstreamVertex, externalId, id, parentEdge, upstreamVertex
-
Fields inherited from interface org.planit.utils.network.physical.LinkSegment
DEFAULT_MAX_SPEED, DEFAULT_NUMBER_OF_LANES, MAXIMUM_DENSITY
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
LinkSegmentImpl(IdGroupingToken groupId, Link parentLink, boolean directionAB)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static int
generateLinkSegmentId(IdGroupingToken groupId)
Generate unique link segment idlong
getLinkSegmentId()
Return id of this instance.double
getMaximumSpeed(Mode mode)
Return the maximum speed along this link for a specified modeint
getNumberOfLanes()
Collect the number of lanes of this segmentLink
getParentLink()
Return the parent link of this link segmentvoid
setMaximumSpeed(Mode mode, double maximumSpeed)
Set the maximum speed along this link for a specified modevoid
setNumberOfLanes(int numberOfLanes)
Set the number of lanes-
Methods inherited from class org.planit.graph.EdgeSegmentImpl
compareTo, generateEdgeSegmentId, getDownstreamVertex, getExternalId, getId, getParentEdge, getUpstreamVertex, hasExternalId, setExternalId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface org.planit.utils.graph.EdgeSegment
getDownstreamVertex, getExternalId, getId, getParentEdge, getUpstreamVertex, hasExternalId, setExternalId
-
Methods inherited from interface org.planit.utils.network.physical.LinkSegment
isModeAllowedThroughLink
-
-
-
-
Constructor Detail
-
LinkSegmentImpl
protected LinkSegmentImpl(IdGroupingToken groupId, Link parentLink, boolean directionAB)
Constructor- Parameters:
groupId
- , contiguous id generation within this group for instances of this classparentLink
- parent link of segmentdirectionAB
- direction of travel
-
-
Method Detail
-
generateLinkSegmentId
protected static int 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
-
getLinkSegmentId
public long getLinkSegmentId()
Description copied from interface:LinkSegment
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
-
getNumberOfLanes
public int getNumberOfLanes()
Description copied from interface:LinkSegment
Collect the number of lanes of this segment- Specified by:
getNumberOfLanes
in interfaceLinkSegment
- Returns:
- number of lanes
-
setNumberOfLanes
public void setNumberOfLanes(int numberOfLanes)
Description copied from interface:LinkSegment
Set the number of lanes- Specified by:
setNumberOfLanes
in interfaceLinkSegment
- Parameters:
numberOfLanes
- to set
-
getMaximumSpeed
public double getMaximumSpeed(Mode mode)
Return the maximum speed along this link for a specified mode- Specified by:
getMaximumSpeed
in interfaceLinkSegment
- Parameters:
mode
- the specified mode- Returns:
- maximum speed along this link for the specified mode
-
setMaximumSpeed
public void setMaximumSpeed(Mode mode, double maximumSpeed)
Set the maximum speed along this link for a specified mode- Specified by:
setMaximumSpeed
in interfaceLinkSegment
- Parameters:
mode
- the specified modemaximumSpeed
- maximum speed along this link for the specified mode
-
getParentLink
public Link getParentLink()
Return the parent link of this link segment- Specified by:
getParentLink
in interfaceLinkSegment
- Returns:
- Link object which is the parent of this link segment
-
-