Class ParameterFactoryByType
- java.lang.Object
-
- org.opentrafficsim.core.parameters.ParameterFactoryByType
-
- All Implemented Interfaces:
ParameterFactory
public class ParameterFactoryByType extends Object implements ParameterFactory
Sets parameter values based on the the GTU type. This includes stochastic parameters. Parameters may also be defined for all GTU types. Similarly, correlations between two parameters can be determined, for all or a specific GTU type.Copyright (c) 2013-2022 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 18 nov. 2016
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ParameterFactoryByType.Correlation<C,T>
Correlates two parameter values.
-
Constructor Summary
Constructors Constructor Description ParameterFactoryByType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <C,T>
voidaddCorrelation(ParameterType<C> first, ParameterType<T> then, ParameterFactoryByType.Correlation<C,T> correlation)
Correlates one parameter to another for all GTU types.<C,T>
voidaddCorrelation(GTUType gtuType, ParameterType<C> first, ParameterType<T> then, ParameterFactoryByType.Correlation<C,T> correlation)
Correlates one parameter to another.<T> void
addParameter(ParameterType<T> parameterType, T value)
Add parameter for all GTU types.void
addParameter(ParameterTypeDouble parameterType, double value)
Add parameter for all GTU types.void
addParameter(ParameterTypeDouble parameterType, DistContinuous distribution)
Add parameter for all GTU types.<U extends Unit<U>,T extends AbstractDoubleScalarRel<U,T>>
voidaddParameter(ParameterTypeNumeric<T> parameterType, ContinuousDistDoubleScalar.Rel<T,U> distribution)
Add parameter for all GTU types.void
addParameter(GTUType gtuType, ParameterType<Double> parameterType, DistContinuous distribution)
void
addParameter(GTUType gtuType, ParameterType<Integer> parameterType, DistDiscrete distribution)
<T> void
addParameter(GTUType gtuType, ParameterType<T> parameterType, T value)
<U extends Unit<U>,T extends AbstractDoubleScalarRel<U,T>>
voidaddParameter(GTUType gtuType, ParameterTypeNumeric<T> parameterType, ContinuousDistDoubleScalar.Rel<T,U> distribution)
void
setValues(Parameters parameters, GTUType gtuType)
Creates a set of parameters for the provided GTU type.String
toString()
-
-
-
Method Detail
-
setValues
public void setValues(Parameters parameters, GTUType gtuType) throws ParameterException
Creates a set of parameters for the provided GTU type.- Specified by:
setValues
in interfaceParameterFactory
- Parameters:
parameters
- Parameters; parametersgtuType
- GTUType; GTU type- Throws:
ParameterException
- when illegal parameter value is set
-
addParameter
public <T> void addParameter(GTUType gtuType, ParameterType<T> parameterType, T value)
- Type Parameters:
T
- parameter value type- Parameters:
gtuType
- GTUType; the gtu typeparameterType
- ParameterType<T>; the parameter typevalue
- T; the value of the parameter
-
addParameter
public <U extends Unit<U>,T extends AbstractDoubleScalarRel<U,T>> void addParameter(GTUType gtuType, ParameterTypeNumeric<T> parameterType, ContinuousDistDoubleScalar.Rel<T,U> distribution)
- Type Parameters:
U
- unit typeT
- parameter value type- Parameters:
gtuType
- GTUType; the gtu typeparameterType
- ParameterTypeNumeric<T>; the parameter typedistribution
- ContinuousDistDoubleScalar.Rel<T,U>; the distribution of the parameter
-
addParameter
public void addParameter(GTUType gtuType, ParameterType<Integer> parameterType, DistDiscrete distribution)
- Parameters:
gtuType
- GTUType; the gtu typeparameterType
- ParameterTypeInteger; the parameter typedistribution
- DistDiscrete; the distribution of the parameter
-
addParameter
public void addParameter(GTUType gtuType, ParameterType<Double> parameterType, DistContinuous distribution)
- Parameters:
gtuType
- GTUType; the gtu typeparameterType
- ParameterTypeDouble; the parameter typedistribution
- DistContinuous; the distribution of the parameter
-
addParameter
public <T> void addParameter(ParameterType<T> parameterType, T value)
Add parameter for all GTU types.- Type Parameters:
T
- type- Parameters:
parameterType
- ParameterType<T>; the parameter typevalue
- T; the value of the parameter
-
addParameter
public void addParameter(ParameterTypeDouble parameterType, double value)
Add parameter for all GTU types.- Parameters:
parameterType
- ParameterTypeDouble; the parameter typevalue
- double; the value of the parameter
-
addParameter
public <U extends Unit<U>,T extends AbstractDoubleScalarRel<U,T>> void addParameter(ParameterTypeNumeric<T> parameterType, ContinuousDistDoubleScalar.Rel<T,U> distribution)
Add parameter for all GTU types.- Type Parameters:
U
- unit typeT
- parameter value type- Parameters:
parameterType
- ParameterTypeNumeric<T>; the parameter typedistribution
- ContinuousDistDoubleScalar.Rel<T,U>; the distribution of the parameter
-
addParameter
public void addParameter(ParameterTypeDouble parameterType, DistContinuous distribution)
Add parameter for all GTU types.- Parameters:
parameterType
- ParameterTypeDouble; the parameter typedistribution
- DistContinuous; the distribution of the parameter
-
addCorrelation
public <C,T> void addCorrelation(GTUType gtuType, ParameterType<C> first, ParameterType<T> then, ParameterFactoryByType.Correlation<C,T> correlation)
Correlates one parameter to another. The parameter 'first' may also benull
, in which case the parameter can be correlated to an external source.- Type Parameters:
C
- parameter value type of first parameterT
- parameter value type of then parameter- Parameters:
gtuType
- GTUType; GTU typefirst
- ParameterType<C>; independent parameterthen
- ParameterType<T>; dependent parametercorrelation
- Correlation<C, T>; correlation
-
addCorrelation
public <C,T> void addCorrelation(ParameterType<C> first, ParameterType<T> then, ParameterFactoryByType.Correlation<C,T> correlation)
Correlates one parameter to another for all GTU types.- Type Parameters:
C
- parameter value type of first parameterT
- parameter value type of then parameter- Parameters:
first
- ParameterType<C>; independent parameterthen
- ParameterType<T>; dependent parametercorrelation
- Correlation<C, T>; correlation
-
-