Class InfrastructureLaneChangeInfo
java.lang.Object
org.opentrafficsim.road.gtu.lane.perception.InfrastructureLaneChangeInfo
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<InfrastructureLaneChangeInfo>
- Direct Known Subclasses:
InfrastructureLaneChangeInfoToledo
public class InfrastructureLaneChangeInfo extends java.lang.Object implements java.lang.Comparable<InfrastructureLaneChangeInfo>, java.io.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 protectedInfrastructureLaneChangeInfo(int requiredNumberOfLaneChanges, boolean deadEnd)Constructor for subclasses.InfrastructureLaneChangeInfo(int requiredNumberOfLaneChanges, LaneStructureRecord record, RelativePosition relativePosition, boolean deadEnd, LateralDirectionality lat)Constructor. -
Method Summary
Modifier and Type Method Description intcompareTo(InfrastructureLaneChangeInfo infrastructureLaneChangeInfo)static InfrastructureLaneChangeInfofromInaccessibleLane(boolean deadEnd)Returns an instance for the case the entire lane is inaccessible.LateralDirectionalitygetLateralDirectionality()Returns the lateral directionality of the required lane changes.LengthgetRemainingDistance()intgetRequiredNumberOfLaneChanges()booleanisDeadEnd()InfrastructureLaneChangeInfoleft(LaneStructureRecord rec, RelativePosition rel, boolean dead)Returns lane change info for one lane towards the left.InfrastructureLaneChangeInforight(LaneStructureRecord rec, RelativePosition rel, boolean dead)Returns lane change info for one lane towards the right.voidsetDeadEnd(boolean deadEnd)Sets whether this reason to change lane is due to a dead-end.java.lang.StringtoString()
-
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:
java.lang.IllegalArgumentException- if required number of lane changes or remaining distance is negativejava.lang.NullPointerException- if remaining distance is null
-
-
Method Details
-
getRequiredNumberOfLaneChanges
public final int getRequiredNumberOfLaneChanges()- Returns:
- requiredNumberOfLaneChanges required number of lane changes.
-
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
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
compareTo
- Specified by:
compareToin interfacejava.lang.Comparable<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
-