Interface Parameters
- All Known Implementing Classes:
ParameterSet
public interface Parameters
Interface for parameter objects containing the methods for during a simulation.
Copyright (c) 2013-2026 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> Optional<T>getOptionalParameter(ParameterType<T> parameterType) Returns a parameter value, ornullif not present.<T> TgetParameter(ParameterType<T> parameterType) Get parameter of given type.voidresetParameter(ParameterType<?> parameterType) Resets the parameter value to the value from before the last resettable set.voidsetAllIn(Parameters parameters) Sets the parameters of this set in the given set.<T> voidsetClaimedParameter(ParameterType<T> parameterType, T value, Object key) Set parameter value of given parameter type.<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 typevalue- new value for the parameter of typeparameterType- Throws:
ParameterException- if the value does not comply with value type constraints or is claimed
-
setClaimedParameter
<T> void setClaimedParameter(ParameterType<T> parameterType, T value, Object key) throws ParameterException Set parameter value of given parameter type. This method claims setting the value by the key. No other key may be used to set the parameter. Different locations of a single logical unit may set the same parameter (with claim) if they share a common key to do so.- Type Parameters:
T- class of value- Parameters:
parameterType- the parameter typevalue- new value for the parameter of typeparameterTypekey- key object for unique right to set the parameter value- Throws:
ParameterException- if the value does not comply with value type constraints or is claimed by another key
-
setParameterResettable
Set parameter value of given parameter type, store old value to allow a reset. This method ignores any claim on the parameter, and should always be followed by a reset.- Type Parameters:
T- class of value- Parameters:
parameterType- the parameter typevalue- 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 resettable set. This goes only a single value back.- Parameters:
parameterType- the parameter type- Throws:
ParameterException- if the parameter was never setNullPointerException- when any input is null
-
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
-
getOptionalParameter
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, empty if 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
-