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 TypeMethodDescriptionbooleancontains(ParameterType<?> parameterType) Indicate whether the given parameter type has been set.<T> TgetParameter(ParameterType<T> parameterType) Get parameter of given type.<T> TgetParameterOrNull(ParameterType<T> parameterType) Returns a parameter value, ornullif not present.voidresetParameter(ParameterType<?> parameterType) Resets the parameter value to the value from before the last set.voidsetAllIn(Parameters parameters) Sets the parameters of this set in the given set.<T> voidsetParameter(ParameterType<T> parameterType, T value) Set parameter value of given parameter type.<T> voidsetParameterResettable(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- the parameter type.value- 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- the parameter type.value- 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- 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- the parameter type.- Returns:
- parameter of the requested type if it exists
- Throws:
ParameterException- If the parameter was never set.
-
getParameterOrNull
Returns a parameter value, ornullif 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- parameter type- Returns:
- parameter value, or
nullif not present
-
contains
Indicate whether the given parameter type has been set.- Parameters:
parameterType- the parameter type to check- Returns:
- true if
parameterTypehas been set; false ifparameterTypehas not been set
-
setAllIn
Sets the parameters of this set in the given set.- Parameters:
parameters- parameters to set the values in
-