Interface LinkSegment
-
- All Superinterfaces:
Comparable<IdAble>
,EdgeSegment
,ExternalIdAble
,GraphEntity
,IdAble
,ManagedId
,Serializable
- All Known Subinterfaces:
MacroscopicLinkSegment
- All Known Implementing Classes:
LinkSegmentBase
,MacroscopicLinkSegmentImpl
public interface LinkSegment extends EdgeSegment
Interface for link segments (directional) part of link (non-directional).- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_MAX_SPEED
Default maximum speed on a link segment in km/hstatic short
DEFAULT_NUMBER_OF_LANES
Default number of lanesstatic Class<LinkSegment>
LINK_SEGMENT_ID_CLASS
additional id class for generating link segment idsstatic double
MAXIMUM_DENSITY
Default maximum link density in pcu/km-
Fields inherited from interface org.goplanit.utils.graph.directed.EdgeSegment
EDGE_SEGMENT_ID_CLASS, getDownstreamVertex, getUpstreamVertex
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description LinkSegment
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.default long
generateLinkSegmentId(IdGroupingToken groupId)
Generate unique link segment idSet<Mode>
getAllowedModes()
Returns the modes that are allowed on the link segment (unmodifiable)default Set<Mode>
getAllowedModesFrom(Collection<Mode> modes)
collect the allowed modes from the passed in modes as newly created setdefault Node
getDownstreamNode()
Collect downstream vertex as nodeNode
getDownstreamVertex()
Get the segment's downstream vertexlong
getLinkSegmentId()
Return id of this instance.default Class<? extends LinkSegment>
getLinkSegmentIdClass()
Return class used to generate unique link ids via the id generatorint
getNumberOfLanes()
Collect the number of lanes of this segmentLink
getParent()
Collect the parent edge of the segmentdefault Link
getParentLink()
Return the parent link of this link segmentdouble
getPhysicalSpeedLimitKmH()
This is the maximum speed (Km/h) that is physically present and a driver can observe from the signs on the roaddefault Node
getUpstreamNode()
Collect upstream vertex as nodeNode
getUpstreamVertex()
Get the segment's upstream vertexdefault boolean
hasNode(Node node)
Verify if node matches any extreme node of link segmentdefault boolean
isDownstreamNode(Node node)
Verify if downstream node matches given nodeboolean
isModeAllowed(Mode mode)
Returns whether vehicles of a specified mode are allowed through this linkdefault boolean
isUpstreamNode(Node node)
Verify if upstream node matches given nodeLinkSegment
setNumberOfLanes(int numberOfLanes)
Set the number of lanesLinkSegment
setPhysicalSpeedLimitKmH(double maximumSpeedKmH)
This is the maximum speed that is physically present and a driver can observe from the signs on the road (km/h)LinkSegment
shallowClone()
Create a shallow copy of this entity-
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.id.ManagedId
recreateManagedIds, resetChildManagedIdEntities
-
-
-
-
Field Detail
-
LINK_SEGMENT_ID_CLASS
static final Class<LinkSegment> LINK_SEGMENT_ID_CLASS
additional id class for generating link segment ids
-
DEFAULT_NUMBER_OF_LANES
static final short DEFAULT_NUMBER_OF_LANES
Default number of lanes- See Also:
- Constant Field Values
-
DEFAULT_MAX_SPEED
static final double DEFAULT_MAX_SPEED
Default maximum speed on a link segment in km/h- See Also:
- Constant Field Values
-
MAXIMUM_DENSITY
static final double MAXIMUM_DENSITY
Default maximum link density in pcu/km- See Also:
- Constant Field Values
-
-
Method Detail
-
getLinkSegmentIdClass
default Class<? extends LinkSegment> getLinkSegmentIdClass()
Return class used to generate unique link ids via the id generator- Returns:
- class type
-
generateLinkSegmentId
default 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
-
isModeAllowed
boolean isModeAllowed(Mode mode)
Returns whether vehicles of a specified mode are allowed through this link- Parameters:
mode
- the specified mode- Returns:
- true if vehicles of this mode can drive along this link, false otherwise
-
getAllowedModes
Set<Mode> getAllowedModes()
Returns the modes that are allowed on the link segment (unmodifiable)- Returns:
- allowed modes
-
getAllowedModesFrom
default Set<Mode> getAllowedModesFrom(Collection<Mode> modes)
collect the allowed modes from the passed in modes as newly created set- Parameters:
modes
- to choose from- Returns:
- allowed modes
-
getLinkSegmentId
long getLinkSegmentId()
Return id of this instance. This id is expected to be generated using the org.planit.utils.misc.IdGenerator- Returns:
- link segment id
-
getNumberOfLanes
int getNumberOfLanes()
Collect the number of lanes of this segment- Returns:
- number of lanes
-
setNumberOfLanes
LinkSegment setNumberOfLanes(int numberOfLanes)
Set the number of lanes- Parameters:
numberOfLanes
- to set- Returns:
- this link segment
-
setPhysicalSpeedLimitKmH
LinkSegment setPhysicalSpeedLimitKmH(double maximumSpeedKmH)
This is the maximum speed that is physically present and a driver can observe from the signs on the road (km/h)- Parameters:
maximumSpeedKmH
- to set- Returns:
- this linkSegment
-
getPhysicalSpeedLimitKmH
double getPhysicalSpeedLimitKmH()
This is the maximum speed (Km/h) that is physically present and a driver can observe from the signs on the road- Returns:
- maximumSpeedKmH
-
getParent
Link getParent()
Collect the parent edge of the segment- Specified by:
getParent
in interfaceEdgeSegment
- Returns:
- parentEdge
-
getUpstreamVertex
Node getUpstreamVertex()
Get the segment's upstream vertex- Specified by:
getUpstreamVertex
in interfaceEdgeSegment
- Returns:
- upstream vertex
-
getDownstreamVertex
Node getDownstreamVertex()
Get the segment's downstream vertex- Specified by:
getDownstreamVertex
in interfaceEdgeSegment
- Returns:
- downstream vertex
-
isDownstreamNode
default boolean isDownstreamNode(Node node)
Verify if downstream node matches given node- Parameters:
node
- to check- Returns:
- true if equal, false otherwise
-
hasNode
default boolean hasNode(Node node)
Verify if node matches any extreme node of link segment- Parameters:
node
- to check- Returns:
- true if present, false otherwise
-
isUpstreamNode
default boolean isUpstreamNode(Node node)
Verify if upstream node matches given node- Parameters:
node
- to check- Returns:
- true if equal, false otherwise
-
shallowClone
LinkSegment shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClone
in interfaceEdgeSegment
- Specified by:
shallowClone
in interfaceGraphEntity
- Specified by:
shallowClone
in interfaceIdAble
- Returns:
- shallow copy of entity
-
deepClone
LinkSegment 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
- Returns:
- deep copy of entity
-
getParentLink
default Link getParentLink()
Return the parent link of this link segment- Returns:
- Link object which is the parent of this link segment
-
getUpstreamNode
default Node getUpstreamNode()
Collect upstream vertex as node- Returns:
- upstream node
-
getDownstreamNode
default Node getDownstreamNode()
Collect downstream vertex as node- Returns:
- downstream node
-
-