package org.opentrafficsim.base.parameters;
/**
* Interface for parameter objects containing the methods for during a simulation.
*
* 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 19 jan. 2018
* @author Alexander Verbraeck
* @author Peter Knoppers
* @author Wouter Schakel
*/
public interface Parameters
{
/**
* Set parameter value of given parameter type.
* @param parameterType ParameterType<T>; the parameter type.
* @param value T; new value for the parameter of type parameterType
.
* @param Class of value.
* @throws ParameterException If the value does not comply with value type constraints.
*/
void setParameter(ParameterType parameterType, T value) throws ParameterException;
/**
* Set parameter value of given parameter type, store old value to allow a reset.
* @param parameterType ParameterType<T>; the parameter type.
* @param value T; new value for the parameter of type parameterType
.
* @param Class of value.
* @throws ParameterException If the value does not comply with value type constraints.
*/
void setParameterResettable(ParameterType parameterType, T value) throws ParameterException;
/**
* Resets the parameter value to the value from before the last set. This goes only a single value back.
* @param parameterType ParameterType<?>; the parameter type.
* @throws ParameterException If the parameter was never set.
*/
void resetParameter(ParameterType> parameterType) throws ParameterException;
/**
* Get parameter of given type.
* @param parameterType ParameterType<T>; the parameter type.
* @param Class of value.
* @return T; parameter of the requested type if it exists
* @throws ParameterException If the parameter was never set.
*/
T getParameter(ParameterType parameterType) throws ParameterException;
/**
* Returns a parameter value, or {@code null} if not present. This can be used to prevent frequent calls to both
* {@code contains()} and {@code getParameter()} in performance critical code.
* @param parameterType ParameterType<T>; parameter type
* @param type of parameter value
* @return parameter value, or {@code null} if not present
*/
T getParameterOrNull(ParameterType parameterType);
/**
* Indicate whether the given parameter type has been set.
* @param parameterType ParameterType<?>; the parameter type to check
* @return boolean; true if parameterType
has been set; false if parameterType
has not been set
*/
boolean contains(ParameterType> parameterType);
/**
* Sets the parameters of this set in the given set.
* @param parameters Parameters; parameters to set the values in
*/
void setAllIn(Parameters parameters);
}