Class SpeedLimitInfo

java.lang.Object
org.opentrafficsim.road.network.speed.SpeedLimitInfo
All Implemented Interfaces:
Serializable

public class SpeedLimitInfo extends Object implements Serializable
Class to contain speed info related to various speed limit types. Instances can reflect the current speed limit situation, some situation ahead, or some situation in the past.

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:
Alexander Verbraeck, Wouter Schakel
See Also:
  • Constructor Details

    • SpeedLimitInfo

      public SpeedLimitInfo()
  • Method Details

    • addSpeedInfo

      public final <T> void addSpeedInfo(SpeedLimitType<T> speedLimitType, T speedInfo)
      Adds or overwrites the speed info of the given speed limit type.
      Type Parameters:
      T - class of speed info
      Parameters:
      speedLimitType - SpeedLimitType<T>; speed limit type to add info for
      speedInfo - T; info regarding the speed limit type
      Throws:
      NullPointerException - if the speed limit type or speed info is null
    • removeSpeedInfo

      public final void removeSpeedInfo(SpeedLimitType<?> speedLimitType)
      Removes the speed info of given speed limit type.
      Parameters:
      speedLimitType - SpeedLimitType<?>; speed limit type of speed info to remove
      Throws:
      NullPointerException - if the speed limit type is null
    • containsType

      public final boolean containsType(SpeedLimitType<?> speedLimitType)
      Whether speed info is present for the given speed limit type.
      Parameters:
      speedLimitType - SpeedLimitType<?>; speed limit type
      Returns:
      whether speed info is present for the given speed limit type
    • getSpeedInfo

      public final <T> T getSpeedInfo(SpeedLimitType<T> speedLimitType)
      Returns the info regarding a specific speed limit type.
      Type Parameters:
      T - class of speed limit type info
      Parameters:
      speedLimitType - SpeedLimitType<T>; speed limit type to return info for
      Returns:
      the speed limit type info
      Throws:
      NullPointerException - if the speed limit type is null
      IllegalStateException - if the speed limit type is not present
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public final String toString()
      Overrides:
      toString in class Object