Record Class SpeedLimits

java.lang.Object
java.lang.Record
org.opentrafficsim.road.network.speed.SpeedLimits
Record Components:
laneSpeedLimit - lane-level speed limit, may be null
gtuTypeSpeedLimit - GTU type level speed limit, may be null

public record SpeedLimits(SpeedLimit laneSpeedLimit, SpeedLimit gtuTypeSpeedLimit) extends Record
Speed limit for an instantaneous context of a single GTU. Two speed limits are included to capture nuances in adherence behavior. For example, normally trucks may drive 80-90km/h based on a vehicle type speed limit of 80km/h on any road with a speed limit higher than 80km/h. But on roads with lower speed limits adherence can be more strict. Although a truck driver could drive 85km/h (5km/h faster than the GTU type limit) on a freeway with a speed limit of 100km/h, on a road with a speed limit of 60km/h the truck driver may adhere to that fully. For a truck driver with low GTU type speed limit adherence (e.g. 95km/h), an enforced lane-level speed limit of 90km/h can be more constraining.

Copyright (c) 2026-2026 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Wouter Schakel
  • Constructor Details

    • SpeedLimits

      public SpeedLimits(SpeedLimit laneSpeedLimit, SpeedLimit gtuTypeSpeedLimit)
      Creates an instance of a SpeedLimits record class.
      Parameters:
      laneSpeedLimit - the value for the laneSpeedLimit record component
      gtuTypeSpeedLimit - the value for the gtuTypeSpeedLimit record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • laneSpeedLimit

      public SpeedLimit laneSpeedLimit()
      Returns the value of the laneSpeedLimit record component.
      Returns:
      the value of the laneSpeedLimit record component
    • gtuTypeSpeedLimit

      public SpeedLimit gtuTypeSpeedLimit()
      Returns the value of the gtuTypeSpeedLimit record component.
      Returns:
      the value of the gtuTypeSpeedLimit record component