Interface Parameters
- All Known Implementing Classes:
ParameterSet
public interface Parameters
Interface for parameter objects containing the methods for during a simulation.
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, Peter Knoppers, Wouter Schakel
-
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(ParameterType<?> parameterType) Indicate whether the given parameter type has been set.<T> T
getParameter
(ParameterType<T> parameterType) Get parameter of given type.<T> T
getParameterOrNull
(ParameterType<T> parameterType) Returns a parameter value, ornull
if not present.void
resetParameter
(ParameterType<?> parameterType) Resets the parameter value to the value from before the last set.void
setAllIn
(Parameters parameters) Sets the parameters of this set in the given set.<T> void
setParameter
(ParameterType<T> parameterType, T value) Set parameter value of given parameter type.<T> void
setParameterResettable
(ParameterType<T> parameterType, T value) Set parameter value of given parameter type, store old value to allow a reset.
-
Method Details
-
setParameter
Set parameter value of given parameter type.- Type Parameters:
T
- Class of value.- Parameters:
parameterType
- ParameterType<T>; the parameter type.value
- T; new value for the parameter of typeparameterType
.- Throws:
ParameterException
- If the value does not comply with value type constraints.
-
setParameterResettable
Set parameter value of given parameter type, store old value to allow a reset.- Type Parameters:
T
- Class of value.- Parameters:
parameterType
- ParameterType<T>; the parameter type.value
- T; new value for the parameter of typeparameterType
.- Throws:
ParameterException
- If the value does not comply with value type constraints.
-
resetParameter
Resets the parameter value to the value from before the last set. This goes only a single value back.- Parameters:
parameterType
- ParameterType<?>; the parameter type.- Throws:
ParameterException
- If the parameter was never set.
-
getParameter
Get parameter of given type.- Type Parameters:
T
- Class of value.- Parameters:
parameterType
- ParameterType<T>; the parameter type.- Returns:
- T; parameter of the requested type if it exists
- Throws:
ParameterException
- If the parameter was never set.
-
getParameterOrNull
Returns a parameter value, ornull
if not present. This can be used to prevent frequent calls to bothcontains()
andgetParameter()
in performance critical code.- Type Parameters:
T
- type of parameter value- Parameters:
parameterType
- ParameterType<T>; parameter type- Returns:
- parameter value, or
null
if not present
-
contains
Indicate whether the given parameter type has been set.- Parameters:
parameterType
- ParameterType<?>; the parameter type to check- Returns:
- boolean; true if
parameterType
has been set; false ifparameterType
has not been set
-
setAllIn
Sets the parameters of this set in the given set.- Parameters:
parameters
- Parameters; parameters to set the values in
-