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-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version May 2, 2016
- Author:
- Wouter Schakel
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
InfrastructureLaneChangeInfo(int requiredNumberOfLaneChanges, boolean deadEnd)
Constructor for subclasses.InfrastructureLaneChangeInfo(int requiredNumberOfLaneChanges, LaneStructureRecord record, RelativePosition relativePosition, boolean deadEnd, LateralDirectionality lat)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(InfrastructureLaneChangeInfo infrastructureLaneChangeInfo)
static InfrastructureLaneChangeInfo
fromInaccessibleLane(boolean deadEnd)
Returns an instance for the case the entire lane is inaccessible.LateralDirectionality
getLateralDirectionality()
Returns the lateral directionality of the required lane changes.Length
getRemainingDistance()
int
getRequiredNumberOfLaneChanges()
boolean
isDeadEnd()
InfrastructureLaneChangeInfo
left(LaneStructureRecord rec, RelativePosition rel, boolean dead)
Returns lane change info for one lane towards the left.InfrastructureLaneChangeInfo
right(LaneStructureRecord rec, RelativePosition rel, boolean dead)
Returns lane change info for one lane towards the right.void
setDeadEnd(boolean deadEnd)
Sets whether this reason to change lane is due to a dead-end.String
toString()
-
-
-
Constructor Detail
-
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 Detail
-
getRequiredNumberOfLaneChanges
public final int getRequiredNumberOfLaneChanges()
- Returns:
- requiredNumberOfLaneChanges required number of lane changes.
-
getRemainingDistance
public 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
public final LateralDirectionality getLateralDirectionality()
Returns the lateral directionality of the required lane changes.- Returns:
- LateralDirectionality; lateral directionality of the required lane changes
-
compareTo
public final int compareTo(InfrastructureLaneChangeInfo infrastructureLaneChangeInfo)
- 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
public static InfrastructureLaneChangeInfo fromInaccessibleLane(boolean deadEnd)
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
-
-