Class SpeedLimitInfo

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

public class SpeedLimitInfo
extends java.lang.Object
implements java.io.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-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 Apr 21, 2016
Author:
Alexander Verbraeck, Wouter Schakel
See Also:
Serialized Form
  • Constructor Summary

    Constructors 
    Constructor Description
    SpeedLimitInfo()  
  • Method Summary

    Modifier and Type Method Description
    <T> void addSpeedInfo​(SpeedLimitType<T> speedLimitType, T speedInfo)
    Adds or overwrites the speed info of the given speed limit type.
    boolean containsType​(SpeedLimitType<?> speedLimitType)
    Whether speed info is present for the given speed limit type.
    boolean equals​(java.lang.Object obj)
    <T> T getSpeedInfo​(SpeedLimitType<T> speedLimitType)
    Returns the info regarding a specific speed limit type.
    int hashCode()
    void removeSpeedInfo​(SpeedLimitType<?> speedLimitType)
    Removes the speed info of given speed limit type.
    java.lang.String toString()

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

  • 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:
      java.lang.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:
      java.lang.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:
      java.lang.NullPointerException - if the speed limit type is null
      java.lang.IllegalStateException - if the speed limit type is not present
    • hashCode

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

      public final boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object
    • toString

      public final java.lang.String toString()
      Overrides:
      toString in class java.lang.Object