Class InfrastructureLaneChangeInfo
java.lang.Object
org.opentrafficsim.road.gtu.lane.perception.InfrastructureLaneChangeInfo
- All Implemented Interfaces:
Serializable
,Comparable<InfrastructureLaneChangeInfo>
- Direct Known Subclasses:
InfrastructureLaneChangeInfoToledo
public class InfrastructureLaneChangeInfo
extends Object
implements Comparable<InfrastructureLaneChangeInfo>, Serializable
Contains information by which drivers know when they need to leave a lane in order to be able to stay on the infrastructure
and follow their route.
Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Wouter Schakel
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
InfrastructureLaneChangeInfo
(int requiredNumberOfLaneChanges, boolean deadEnd) Constructor for subclasses.InfrastructureLaneChangeInfo
(int requiredNumberOfLaneChanges, LaneStructureRecord record, RelativePosition relativePosition, boolean deadEnd, LateralDirectionality lat) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal int
compareTo
(InfrastructureLaneChangeInfo infrastructureLaneChangeInfo) static InfrastructureLaneChangeInfo
fromInaccessibleLane
(boolean deadEnd) Returns an instance for the case the entire lane is inaccessible.final LateralDirectionality
Returns the lateral directionality of the required lane changes.org.djunits.value.vdouble.scalar.Length
final int
final boolean
left
(LaneStructureRecord rec, RelativePosition rel, boolean dead) Returns lane change info for one lane towards the left.right
(LaneStructureRecord rec, RelativePosition rel, boolean dead) Returns lane change info for one lane towards the right.final void
setDeadEnd
(boolean deadEnd) Sets whether this reason to change lane is due to a dead-end.toString()
-
Constructor Details
-
InfrastructureLaneChangeInfo
protected InfrastructureLaneChangeInfo(int requiredNumberOfLaneChanges, boolean deadEnd) Constructor for subclasses.- Parameters:
requiredNumberOfLaneChanges
- int; required number of lane changesdeadEnd
- boolean; whether the need to change lane comes from a dead-end
-
InfrastructureLaneChangeInfo
public InfrastructureLaneChangeInfo(int requiredNumberOfLaneChanges, LaneStructureRecord record, RelativePosition relativePosition, boolean deadEnd, LateralDirectionality lat) Constructor.- Parameters:
requiredNumberOfLaneChanges
- int; required number of lane changesrecord
- LaneStructureRecord; record who's end defines the remaining distancerelativePosition
- RelativePosition; critical relative position (i.e. nose when driving forward)deadEnd
- boolean; whether the need to change lane comes from a dead-endlat
- LateralDirectionality; lateral directionality of required lane changes- Throws:
IllegalArgumentException
- if required number of lane changes or remaining distance is negativeNullPointerException
- if remaining distance is null
-
-
Method Details
-
getRequiredNumberOfLaneChanges
public final int getRequiredNumberOfLaneChanges()- Returns:
- requiredNumberOfLaneChanges required number of lane changes.
-
getRemainingDistance
public org.djunits.value.vdouble.scalar.Length getRemainingDistance()- Returns:
- remainingDistance remaining distance to perform required lane changes.
-
isDeadEnd
public final boolean isDeadEnd()- Returns:
- whether this reason to change lane is due to a dead-end.
-
setDeadEnd
public final void setDeadEnd(boolean deadEnd) Sets whether this reason to change lane is due to a dead-end.- Parameters:
deadEnd
- boolean; whether the need to change lane comes from a dead-end
-
getLateralDirectionality
Returns the lateral directionality of the required lane changes.- Returns:
- LateralDirectionality; lateral directionality of the required lane changes
-
toString
-
compareTo
- Specified by:
compareTo
in interfaceComparable<InfrastructureLaneChangeInfo>
-
left
public final InfrastructureLaneChangeInfo left(LaneStructureRecord rec, RelativePosition rel, boolean dead) Returns lane change info for one lane towards the left.- Parameters:
rec
- LaneStructureRecord; record who's end defines the remaining distancerel
- RelativePosition; critical relative position (i.e. nose when driving forward)dead
- boolean; whether the need to change lane comes from a dead-end- Returns:
- InfrastructureLaneChangeInfo; lane change info for one lane towards the left
-
right
public final InfrastructureLaneChangeInfo right(LaneStructureRecord rec, RelativePosition rel, boolean dead) Returns lane change info for one lane towards the right.- Parameters:
rec
- LaneStructureRecord; record who's end defines the remaining distancerel
- RelativePosition; critical relative position (i.e. nose when driving forward)dead
- boolean; whether the need to change lane comes from a dead-end- Returns:
- InfrastructureLaneChangeInfo; lane change info for one lane towards the right
-
fromInaccessibleLane
Returns an instance for the case the entire lane is inaccessible.- Parameters:
deadEnd
- boolean; dead end- Returns:
- instance for the case the entire lane is inaccessible
-