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 Details

    • InfrastructureLaneChangeInfo

      protected InfrastructureLaneChangeInfo(int requiredNumberOfLaneChanges, boolean deadEnd)
      Constructor for subclasses.
      Parameters:
      requiredNumberOfLaneChanges - int; required number of lane changes
      deadEnd - 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 changes
      record - LaneStructureRecord; record who's end defines the remaining distance
      relativePosition - RelativePosition; critical relative position (i.e. nose when driving forward)
      deadEnd - boolean; whether the need to change lane comes from a dead-end
      lat - LateralDirectionality; lateral directionality of required lane changes
      Throws:
      IllegalArgumentException - if required number of lane changes or remaining distance is negative
      NullPointerException - 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

      public final LateralDirectionality getLateralDirectionality()
      Returns the lateral directionality of the required lane changes.
      Returns:
      LateralDirectionality; lateral directionality of the required lane changes
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public final int compareTo(InfrastructureLaneChangeInfo infrastructureLaneChangeInfo)
      Specified by:
      compareTo in interface 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 distance
      rel - 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 distance
      rel - 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