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-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 18 nov. 2016
Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Constructor Details

  • Method Details

    • setValues

      public void setValues​(Parameters parameters, GTUType gtuType) throws ParameterException
      Creates a set of parameters for the provided GTU type.
      Specified by:
      setValues in interface ParameterFactory
      Parameters:
      parameters - Parameters; parameters
      gtuType - 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 type
      parameterType - ParameterType<T>; the parameter type
      value - 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 type
      T - parameter value type
      Parameters:
      gtuType - GTUType; the gtu type
      parameterType - ParameterTypeNumeric<T>; the parameter type
      distribution - 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 type
      parameterType - ParameterTypeInteger; the parameter type
      distribution - DistDiscrete; the distribution of the parameter
    • addParameter

      public void addParameter​(GTUType gtuType, ParameterType<Double> parameterType, DistContinuous distribution)
      Parameters:
      gtuType - GTUType; the gtu type
      parameterType - ParameterTypeDouble; the parameter type
      distribution - 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 type
      value - 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 type
      value - 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 type
      T - parameter value type
      Parameters:
      parameterType - ParameterTypeNumeric<T>; the parameter type
      distribution - 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 type
      distribution - 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 be null, in which case the parameter can be correlated to an external source.
      Type Parameters:
      C - parameter value type of first parameter
      T - parameter value type of then parameter
      Parameters:
      gtuType - GTUType; GTU type
      first - ParameterType<C>; independent parameter
      then - ParameterType<T>; dependent parameter
      correlation - 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 parameter
      T - parameter value type of then parameter
      Parameters:
      first - ParameterType<C>; independent parameter
      then - ParameterType<T>; dependent parameter
      correlation - Correlation<C, T>; correlation
    • toString

      public String toString()
      Overrides:
      toString in class Object