Class ParameterFactoryOneShot
java.lang.Object
org.opentrafficsim.core.parameters.ParameterFactoryByType
org.opentrafficsim.core.parameters.ParameterFactoryOneShot
- All Implemented Interfaces:
ParameterFactory
Extends
ParameterFactoryByType with a one-shot mode. By calling setOneShotMode() all parameters and
correlations added between a call to said method and to setValues() are removed from
the factory after the call to setValues().
Copyright (c) 2024-2026 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Wouter Schakel
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opentrafficsim.core.parameters.ParameterFactoryByType
ParameterFactoryByType.Correlation<C,T> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<C,V> void addCorrelation(ParameterType<C> first, ParameterType<V> then, ParameterFactoryByType.Correlation<C, V> correlation) Correlates one parameter to another for all GTU types.<C,V> void addCorrelation(GtuType gtuType, ParameterType<C> first, ParameterType<V> then, ParameterFactoryByType.Correlation<C, V> correlation) Correlates one parameter to another.<V> voidaddParameter(ParameterType<V> parameterType, V value) Add parameter for all GTU types.voidaddParameter(ParameterTypeDouble parameterType, double value) Add parameter for all GTU types.voidaddParameter(ParameterTypeDouble parameterType, DistContinuous distribution) Add parameter for all GTU types.<U extends Unit<U>,V extends org.djunits.value.vdouble.scalar.base.DoubleScalarRel<U, V>>
voidaddParameter(ParameterTypeNumeric<V> parameterType, ContinuousDistDoubleScalar.Rel<V, U> distribution) Add parameter for all GTU types.voidaddParameter(GtuType gtuType, ParameterType<Double> parameterType, DistContinuous distribution) Add parameter.voidaddParameter(GtuType gtuType, ParameterType<Integer> parameterType, DistDiscrete distribution) Add parameter.<V> voidaddParameter(GtuType gtuType, ParameterType<V> parameterType, V value) Add parameter.<U extends Unit<U>,V extends org.djunits.value.vdouble.scalar.base.DoubleScalarRel<U, V>>
voidaddParameter(GtuType gtuType, ParameterTypeNumeric<V> parameterType, ContinuousDistDoubleScalar.Rel<V, U> distribution) Add parameter.voidSets the factory to one-shot mode.voidsetValues(Parameters parameters, GtuType gtuType) Creates a set of parameters for the provided GTU type.Methods inherited from class org.opentrafficsim.core.parameters.ParameterFactoryByType
applyCorrelationsAndSetValues, correlateValue, getBaseValues, getCorrelations, setParameterValue, setValues, toString
-
Constructor Details
-
ParameterFactoryOneShot
public ParameterFactoryOneShot()Constructor.
-
-
Method Details
-
setOneShotMode
public void setOneShotMode()Sets the factory to one-shot mode. All parameters and correlations added between a call to this method and tosetValues()are removed from the factory after the call tosetValues(). -
setValues
Creates a set of parameters for the provided GTU type. Removes any parameters or correlations that were set in one-shot mode. One-shot mode is disabled.- Specified by:
setValuesin interfaceParameterFactory- Overrides:
setValuesin classParameterFactoryByType- Parameters:
parameters- parametersgtuType- GTU type- Throws:
ParameterException- when illegal parameter value is set
-
addParameter
Description copied from class:ParameterFactoryByTypeAdd parameter.- Overrides:
addParameterin classParameterFactoryByType- Type Parameters:
V- parameter value type- Parameters:
gtuType- the gtu typeparameterType- the parameter typevalue- the value of the parameter
-
addParameter
public <U extends Unit<U>,V extends org.djunits.value.vdouble.scalar.base.DoubleScalarRel<U, void addParameterV>> (GtuType gtuType, ParameterTypeNumeric<V> parameterType, ContinuousDistDoubleScalar.Rel<V, U> distribution) Description copied from class:ParameterFactoryByTypeAdd parameter.- Overrides:
addParameterin classParameterFactoryByType- Type Parameters:
U- unit typeV- parameter value type- Parameters:
gtuType- the gtu typeparameterType- the parameter typedistribution- ContinuousDistDoubleScalar.Rel<T,U>; the distribution of the parameter
-
addParameter
public void addParameter(GtuType gtuType, ParameterType<Integer> parameterType, DistDiscrete distribution) Description copied from class:ParameterFactoryByTypeAdd parameter.- Overrides:
addParameterin classParameterFactoryByType- Parameters:
gtuType- the gtu typeparameterType- the parameter typedistribution- the distribution of the parameter
-
addParameter
public void addParameter(GtuType gtuType, ParameterType<Double> parameterType, DistContinuous distribution) Description copied from class:ParameterFactoryByTypeAdd parameter.- Overrides:
addParameterin classParameterFactoryByType- Parameters:
gtuType- the gtu typeparameterType- the parameter typedistribution- the distribution of the parameter
-
addParameter
Description copied from class:ParameterFactoryByTypeAdd parameter for all GTU types.- Overrides:
addParameterin classParameterFactoryByType- Type Parameters:
V- type- Parameters:
parameterType- the parameter typevalue- the value of the parameter
-
addParameter
Description copied from class:ParameterFactoryByTypeAdd parameter for all GTU types.- Overrides:
addParameterin classParameterFactoryByType- Parameters:
parameterType- the parameter typevalue- the value of the parameter
-
addParameter
public <U extends Unit<U>,V extends org.djunits.value.vdouble.scalar.base.DoubleScalarRel<U, void addParameterV>> (ParameterTypeNumeric<V> parameterType, ContinuousDistDoubleScalar.Rel<V, U> distribution) Description copied from class:ParameterFactoryByTypeAdd parameter for all GTU types.- Overrides:
addParameterin classParameterFactoryByType- Type Parameters:
U- unit typeV- parameter value type- Parameters:
parameterType- the parameter typedistribution- ContinuousDistDoubleScalar.Rel<T,U>; the distribution of the parameter
-
addParameter
Description copied from class:ParameterFactoryByTypeAdd parameter for all GTU types.- Overrides:
addParameterin classParameterFactoryByType- Parameters:
parameterType- the parameter typedistribution- the distribution of the parameter
-
addCorrelation
public <C,V> void addCorrelation(GtuType gtuType, ParameterType<C> first, ParameterType<V> then, ParameterFactoryByType.Correlation<C, V> correlation) Description copied from class:ParameterFactoryByTypeCorrelates one parameter to another. The parameter 'first' may also benull, in which case the parameter can be correlated to an external source.- Overrides:
addCorrelationin classParameterFactoryByType- Type Parameters:
C- parameter value type of first parameterV- parameter value type of then parameter- Parameters:
gtuType- GTU typefirst- independent parameterthen- dependent parametercorrelation- correlation
-
addCorrelation
public <C,V> void addCorrelation(ParameterType<C> first, ParameterType<V> then, ParameterFactoryByType.Correlation<C, V> correlation) Description copied from class:ParameterFactoryByTypeCorrelates one parameter to another for all GTU types.- Overrides:
addCorrelationin classParameterFactoryByType- Type Parameters:
C- parameter value type of first parameterV- parameter value type of then parameter- Parameters:
first- independent parameterthen- dependent parametercorrelation- correlation
-