Class MacroscopicLinkSegmentImpl
- 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<MacroscopicLink>
-
- org.goplanit.network.layer.macroscopic.MacroscopicLinkSegmentImpl
-
- All Implemented Interfaces:
Serializable
,Comparable<IdAble>
,EdgeSegment
,GraphEntity
,ExternalIdAble
,IdAble
,ManagedId
,MacroscopicLinkSegment
,LinkSegment
,PcuCapacitated
public class MacroscopicLinkSegmentImpl extends LinkSegmentBase<MacroscopicLink> implements MacroscopicLinkSegment
Link segment for macroscopic transport networks.- Author:
- markr
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected MacroscopicLinkSegmentType
linkSegmentType
the link type of this link containing all macroscopic features by user class-
Fields inherited from class org.goplanit.network.layer.physical.LinkSegmentBase
linkSegmentId, numberOfLanes, physicalSpeedLinkKmh
-
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
MacroscopicLinkSegmentImpl(MacroscopicLinkSegmentImpl other, boolean deepCopy)
Copy constructorprotected
MacroscopicLinkSegmentImpl(IdGroupingToken groupId, MacroscopicLink parentLink, boolean directionAB)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
computeFreeFlowTravelTimeHour(Mode mode)
Compute the free flow travel time by mode, i.e.MacroscopicLinkSegmentImpl
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.Set<Mode>
getAllowedModes()
Returns the modes that are allowed on the link segment (unmodifiable)MacroscopicLinkSegmentType
getLinkSegmentType()
Collect the link segment type of the link segmentboolean
isModeAllowed(Mode mode)
Returns whether vehicles of a specified mode are allowed through this linkvoid
setLinkSegmentType(MacroscopicLinkSegmentType linkSegmentType)
Set the link segment type this link segment adheres toMacroscopicLinkSegmentImpl
shallowClone()
Create a shallow copy of this entity-
Methods inherited from class org.goplanit.network.layer.physical.LinkSegmentBase
getDownstreamVertex, getLinkSegmentId, getNumberOfLanes, getParent, getPhysicalSpeedLimitKmH, getUpstreamVertex, recreateLinkSegmentId, recreateManagedIds, setLinkSegmentId, setNumberOfLanes, setPhysicalSpeedLimitKmH
-
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, getAllowedModesFrom, getDownstreamNode, getLinkSegmentId, getLinkSegmentIdClass, getNumberOfLanes, getParent, getPhysicalSpeedLimitKmH, getUpstreamNode, hasNode, isDownstreamNode, isUpstreamNode, setNumberOfLanes, setPhysicalSpeedLimitKmH
-
Methods inherited from interface org.goplanit.utils.network.layer.macroscopic.MacroscopicLinkSegment
getCapacityOrDefaultPcuH, getCapacityOrDefaultPcuHLane, getDownstreamVertex, getModelledSpeedLimitKmH, getParentLink, getUpstreamVertex, hasLinkSegmentType
-
Methods inherited from interface org.goplanit.utils.id.ManagedId
recreateManagedIds, resetChildManagedIdEntities
-
-
-
-
Field Detail
-
linkSegmentType
protected MacroscopicLinkSegmentType linkSegmentType
the link type of this link containing all macroscopic features by user class
-
-
Constructor Detail
-
MacroscopicLinkSegmentImpl
protected MacroscopicLinkSegmentImpl(IdGroupingToken groupId, MacroscopicLink parentLink, boolean directionAB)
Constructor- Parameters:
groupId
- contiguous id generation within this group for instances of this classparentLink
- the parent link of this link segmentdirectionAB
- direction of travel
-
MacroscopicLinkSegmentImpl
protected MacroscopicLinkSegmentImpl(MacroscopicLinkSegmentImpl other, boolean deepCopy)
Copy constructor- Parameters:
other
- to copydeepCopy
- when true, create a deep copy, shallow copy otherwise
-
-
Method Detail
-
computeFreeFlowTravelTimeHour
public double computeFreeFlowTravelTimeHour(Mode mode)
Compute the free flow travel time by mode, i.e. when the link's maximum speed might be capped by the mode's maximum speed If the input data are invalid, this method logs the problem and returns a negative value. In case the mode is not supported the maximum possible double value is returned as the free flow travel time- Specified by:
computeFreeFlowTravelTimeHour
in interfaceMacroscopicLinkSegment
- Parameters:
mode
- mode of travel- Returns:
- freeFlowTravelTime for this mode
-
isModeAllowed
public boolean isModeAllowed(Mode mode)
Returns whether vehicles of a specified mode are allowed through this link- Specified by:
isModeAllowed
in interfaceLinkSegment
- Parameters:
mode
- the specified mode- Returns:
- true if vehicles of this mode can drive along this link, false otherwise
-
getAllowedModes
public Set<Mode> getAllowedModes()
Returns the modes that are allowed on the link segment (unmodifiable)- Specified by:
getAllowedModes
in interfaceLinkSegment
- Returns:
- allowed modes
-
setLinkSegmentType
public void setLinkSegmentType(MacroscopicLinkSegmentType linkSegmentType)
Set the link segment type this link segment adheres to- Specified by:
setLinkSegmentType
in interfaceMacroscopicLinkSegment
- Parameters:
linkSegmentType
- the link segment type
-
getLinkSegmentType
public MacroscopicLinkSegmentType getLinkSegmentType()
Collect the link segment type of the link segment- Specified by:
getLinkSegmentType
in interfaceMacroscopicLinkSegment
- Returns:
- the link segment
-
shallowClone
public MacroscopicLinkSegmentImpl 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
- Specified by:
shallowClone
in interfaceMacroscopicLinkSegment
- Specified by:
shallowClone
in classLinkSegmentBase<MacroscopicLink>
- Returns:
- shallow copy of entity
-
deepClone
public MacroscopicLinkSegmentImpl 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
- Specified by:
deepClone
in interfaceMacroscopicLinkSegment
- Specified by:
deepClone
in classLinkSegmentBase<MacroscopicLink>
- Returns:
- deep copy of entity
-
-