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-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
All Methods Instance Methods Concrete Methods 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(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.String
toString()
-
-
-
Method Detail
-
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 forspeedInfo
- 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 nullIllegalStateException
- if the speed limit type is not present
-
-