public class ParameterSet extends Object implements Parameters, Serializable
Parameters with methods to initialize the set of parameters.
 
 Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. 
 BSD-style license. See OpenTrafficSim License.
 
| Constructor and Description | 
|---|
| ParameterSet()Construct a new, empty Parameters set. | 
| ParameterSet(Parameters parameters)Constructor which creates a copy of the input set. | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | 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, or  nullif not present. | 
| Map<ParameterType<?>,Object> | getParameters()Returns a safe copy of the parameters. | 
| void | resetParameter(ParameterType<?> parameterType)Resets the parameter value to the value from before the last set. | 
| void | setAllIn(Parameters params)Sets the parameters of this set in the given set. | 
| <T> ParameterSet | setDefaultParameter(ParameterType<T> parameter)Sets the default value of a parameter. | 
| ParameterSet | setDefaultParameters(Class<?> clazz)Sets the default values of all accessible parameters defined in the given class. | 
| <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. | 
| String | toString() | 
public ParameterSet()
public ParameterSet(Parameters parameters)
parameters - Parameters; input set to copy into the new Parameters objectpublic final <T> void setParameter(ParameterType<T> parameterType, T value) throws ParameterException
setParameter in interface ParametersT - Class of value.parameterType - ParameterType<T>; the parameter type.value - T; new value for the parameter of type parameterType.ParameterException - If the value does not comply with value type constraints.public final <T> void setParameterResettable(ParameterType<T> parameterType, T value) throws ParameterException
setParameterResettable in interface ParametersT - Class of value.parameterType - ParameterType<T>; the parameter type.value - T; new value for the parameter of type parameterType.ParameterException - If the value does not comply with value type constraints.public final void resetParameter(ParameterType<?> parameterType) throws ParameterException
resetParameter in interface ParametersparameterType - ParameterType<?>; the parameter type.ParameterException - If the parameter was never set.public <T> T getParameter(ParameterType<T> parameterType) throws ParameterException
getParameter in interface ParametersT - Class of value.parameterType - ParameterType<T>; the parameter type.ParameterException - If the parameter was never set.public final <T> T getParameterOrNull(ParameterType<T> parameterType)
null if not present. This can be used to prevent frequent calls to both
 contains() and getParameter() in performance critical code.getParameterOrNull in interface ParametersT - type of parameter valueparameterType - ParameterType<T>; parameter typenull if not presentpublic final boolean contains(ParameterType<?> parameterType)
contains in interface ParametersparameterType - ParameterType<?>; the parameter type to checkparameterType has been set; false if parameterType has not been setpublic final Map<ParameterType<?>,Object> getParameters()
public final <T> ParameterSet setDefaultParameter(ParameterType<T> parameter) throws ParameterException
T - Class of the valueparameter - ParameterType<T>; the parameter to set the default value ofParameterException - if the parameter type has no default valuepublic final ParameterSet setDefaultParameters(Class<?> clazz)
clazz - Class<?>; class with parameterspublic final void setAllIn(Parameters params)
setAllIn in interface Parametersparams - Parameters; parameters to set the values inCopyright © 2014–2019 Delft University of Technology. All rights reserved.