Class RollingLaneStructureRecord
java.lang.Object
org.opentrafficsim.road.gtu.lane.perception.RollingLaneStructureRecord
- All Implemented Interfaces:
Serializable,LaneRecord<LaneStructureRecord>,LaneStructureRecord
public class RollingLaneStructureRecord extends Object implements LaneStructureRecord, Serializable
A LaneStructureRecord contains information about the lanes that can be accessed from this lane by a GTUType. It tells whether
there is a left and/or right lane by pointing to other LaneStructureRecords, and which successor LaneStructureRecord(s) there
are at the end of the lane of this LaneStructureRecord. All information (left, right, next) is calculated relative to the
driving direction of the GTU that owns this structure.
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRollingLaneStructureRecord.RecordLinkLink between records that defines the dependence of start position and hence how this is updated as the GTU moves. -
Constructor Summary
Constructors Constructor Description RollingLaneStructureRecord(Lane lane, GTUDirectionality direction, Length startDistance)RollingLaneStructureRecord(Lane lane, GTUDirectionality direction, RollingLaneStructureRecord startDistanceSource, RollingLaneStructureRecord.RecordLink recordLink)Constructor. -
Method Summary
Modifier and Type Method Description voidaddNext(RollingLaneStructureRecord next)voidaddPrev(RollingLaneStructureRecord prev)booleanallowsRoute(Route route, GTUType gtuType)Returns whether this lane allows the route to be followed.booleanallowsRouteAtEnd(Route route, GTUType gtuType)Returns whether the end of this lane allows the route to be followed.voidclearCutOffEnd()Clears the cut-off at the end.voidclearCutOffStart()Clears the cut-off at the start.LengthgetCutOffEnd()Returns distance where the structure was cut-off.LengthgetCutOffStart()Returns distance where the structure was cut-off.GTUDirectionalitygetDirection()Returns the direction of travel.NodegetFromNode()Returns the the 'from' node of the link belonging to this lane, in the driving direction.LanegetLane()Returns the lane.RollingLaneStructureRecordgetLeft()Returns the left LSR or null if not available.LengthgetLength()Returns the length of the lane.List<RollingLaneStructureRecord>getNext()Returns a list of next lanes.List<RollingLaneStructureRecord>getPrev()Returns a list of previous lanes.RollingLaneStructureRecordgetRight()Returns the right LSR or null if not available.LengthgetStartDistance()Returns the distance from a reference to the start of this lane, negative for upstream distance.NodegetToNode()Returns the the 'to' node of the link belonging to this lane, in the driving direction.booleanisCutOffEnd()Returns whether this lane has no next records as the lane structure was cut-off.booleanisCutOffStart()Returns whether this lane has no previous records as the lane structure was cut-off.booleanisDeadEnd()Returns whether the record forms a dead-end.booleanisDownstreamBranch()Returns whether the record is part of the downstream branch.booleanisLinkMerge()booleanisLinkSplit()Deprecated.booleanlegalLeft()Returns whether a left lane change is legal.booleanlegalRight()Returns whether a right lane change is legal.booleanphysicalLeft()Returns whether a left lane change is physically possible.booleanphysicalRight()Returns whether a right lane change is physically possible.voidsetCutOffEnd(Length cutOffEnd)Sets this record as being cut-off, i.e.voidsetCutOffStart(Length cutOffStart)Sets this record as being cut-off, i.e.voidsetLeft(RollingLaneStructureRecord leftRecord, GTUType gtuType)voidsetRight(RollingLaneStructureRecord rightRecord, GTUType gtuType)StringtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opentrafficsim.road.gtu.lane.perception.LaneRecord
getDistanceToPositionMethods inherited from interface org.opentrafficsim.road.gtu.lane.perception.LaneStructureRecord
possibleLeft, possibleRight
-
Constructor Details
-
RollingLaneStructureRecord
public RollingLaneStructureRecord(Lane lane, GTUDirectionality direction, RollingLaneStructureRecord startDistanceSource, RollingLaneStructureRecord.RecordLink recordLink)Constructor.- Parameters:
lane- Lane; lanedirection- GTUDirectionality; direction of travel for the GTUstartDistanceSource- RollingLaneStructureRecord; record on which the start distance is basedrecordLink- RecordLink; link type to source
-
RollingLaneStructureRecord
- Parameters:
lane- Lane; the lane of the LSRdirection- GTUDirectionality; the direction on which we process this lanestartDistance- Length; distance to start of the record, negative for backwards
-
-
Method Details
-
getLength
Returns the length of the lane.- Specified by:
getLengthin interfaceLaneRecord<LaneStructureRecord>- Returns:
- Length; length of the lane.
-
getFromNode
Returns the the 'from' node of the link belonging to this lane, in the driving direction.- Specified by:
getFromNodein interfaceLaneStructureRecord- Returns:
- Node; the 'from' node of the link belonging to this lane, in the driving direction
-
getToNode
Returns the the 'to' node of the link belonging to this lane, in the driving direction.- Specified by:
getToNodein interfaceLaneStructureRecord- Returns:
- Node; the 'to' node of the link belonging to this lane, in the driving direction
-
isLinkSplit
Deprecated.- Returns:
- whether the link to which this lane belongs splits, i.e. some of the parallel, connected lanes lead to a different destination than others
-
isLinkMerge
public final boolean isLinkMerge()- Returns:
- whether the link to which this lane belongs merges, i.e. some of the parallel, connected lanes follow from a different origin than others
-
allowsRoute
Returns whether this lane allows the route to be followed.- Specified by:
allowsRoutein interfaceLaneStructureRecord- Parameters:
route- Route; the route to followgtuType- GTUType; gtu type- Returns:
- whether this lane allows the route to be followed
- Throws:
NetworkException- if no destination node
-
allowsRouteAtEnd
Returns whether the end of this lane allows the route to be followed.- Specified by:
allowsRouteAtEndin interfaceLaneStructureRecord- Parameters:
route- Route; the route to followgtuType- GTUType; gtu type- Returns:
- whether the end of this lane allows the route to be followed
- Throws:
NetworkException- if no destination node
-
getLeft
Returns the left LSR or null if not available. Left and right are relative to the driving direction.- Specified by:
getLeftin interfaceLaneStructureRecord- Returns:
- LaneStructureRecord; the left LSR or null if not available
-
setLeft
- Parameters:
leftRecord- RollingLaneStructureRecord; set the left LSR or null if not available. Left and right are relative to the <b>driving</b> direction.gtuType- GTUType; GTU type
-
legalLeft
public final boolean legalLeft()Returns whether a left lane change is legal.- Specified by:
legalLeftin interfaceLaneStructureRecord- Returns:
- whether a left lane change is legal
-
physicalLeft
public final boolean physicalLeft()Returns whether a left lane change is physically possible.- Specified by:
physicalLeftin interfaceLaneStructureRecord- Returns:
- whether a left lane change is physically possible
-
getRight
Returns the right LSR or null if not available. Left and right are relative to the driving direction.- Specified by:
getRightin interfaceLaneStructureRecord- Returns:
- LaneStructureRecord; the right LSR or null if not available
-
setRight
- Parameters:
rightRecord- RollingLaneStructureRecord; set the right LSR or null if not available. Left and right are relative to the <b>driving</b> directiongtuType- GTUType; GTU type
-
legalRight
public final boolean legalRight()Returns whether a right lane change is legal.- Specified by:
legalRightin interfaceLaneStructureRecord- Returns:
- whether a right lane change is legal
-
physicalRight
public final boolean physicalRight()Returns whether a right lane change is physically possible.- Specified by:
physicalRightin interfaceLaneStructureRecord- Returns:
- whether a right lane change is physically possible
-
getNext
Returns a list of next lanes. Callers of this method do not have to mind GTUDirectionality, this is taken care of.- Specified by:
getNextin interfaceLaneRecord<LaneStructureRecord>- Returns:
- List; list of next lanes
-
addNext
- Parameters:
next- RollingLaneStructureRecord; a next LSRs to add. Next is relative to the driving direction, not to the design line direction.- Throws:
GTUException- if the records is cut-off at the end
-
getPrev
Returns a list of previous lanes. Callers of this method do not have to mind GTUDirectionality, this is taken care of.- Specified by:
getPrevin interfaceLaneRecord<LaneStructureRecord>- Returns:
- List; list of previous lanes
-
addPrev
- Parameters:
prev- RollingLaneStructureRecord; a previous LSRs to add. Previous is relative to the driving direction, not to the design line direction.- Throws:
GTUException- if the records is cut-off at the start
-
setCutOffEnd
Sets this record as being cut-off, i.e. there are no next records due to cut-off.- Parameters:
cutOffEnd- Length; where this lane was cut-off (in the driving direction) resulting in no next lanes- Throws:
GTUException- if there are next records
-
setCutOffStart
Sets this record as being cut-off, i.e. there are no previous records due to cut-off.- Parameters:
cutOffStart- Length; where this lane was cut-off (in the driving direction) resulting in no prev lanes- Throws:
GTUException- if there are previous records
-
isCutOffEnd
public final boolean isCutOffEnd()Returns whether this lane has no next records as the lane structure was cut-off.- Specified by:
isCutOffEndin interfaceLaneStructureRecord- Returns:
- whether this lane has no next records as the lane structure was cut-off
-
isCutOffStart
public final boolean isCutOffStart()Returns whether this lane has no previous records as the lane structure was cut-off.- Specified by:
isCutOffStartin interfaceLaneStructureRecord- Returns:
- whether this lane has no previous records as the lane structure was cut-off
-
getCutOffEnd
Returns distance where the structure was cut-off.- Returns:
- distance where the structure was cut-off
-
getCutOffStart
Returns distance where the structure was cut-off.- Returns:
- distance where the structure was cut-off
-
clearCutOffEnd
public final void clearCutOffEnd()Clears the cut-off at the end. -
clearCutOffStart
public final void clearCutOffStart()Clears the cut-off at the start. -
isDeadEnd
public final boolean isDeadEnd()Returns whether the record forms a dead-end.- Specified by:
isDeadEndin interfaceLaneStructureRecord- Returns:
- whether the record forms a dead-end
-
getLane
Returns the lane.- Specified by:
getLanein interfaceLaneRecord<LaneStructureRecord>- Returns:
- Lane lane;
-
getDirection
Returns the direction of travel.- Specified by:
getDirectionin interfaceLaneRecord<LaneStructureRecord>- Returns:
- GTUDirectionality; direction of travel
-
getStartDistance
Returns the distance from a reference to the start of this lane, negative for upstream distance.- Specified by:
getStartDistancein interfaceLaneRecord<LaneStructureRecord>- Returns:
- Length; the distance from a reference to the start of this lane, negative for upstream distance
-
isDownstreamBranch
public boolean isDownstreamBranch()Returns whether the record is part of the downstream branch. This means the GTU can potentially get here and the lane is not upstream or on the other branch upstream of a merge. Default implementation returnstrue.- Specified by:
isDownstreamBranchin interfaceLaneRecord<LaneStructureRecord>- Returns:
- Boolean; whether the record is part of the downstream branch
-
toString
-