Interface Parameters

All Known Implementing Classes:
ParameterSet

public interface Parameters
Interface for parameter objects containing the methods for during a simulation.

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Method Details

    • setParameter

      <T> void setParameter(ParameterType<T> parameterType, T value) throws ParameterException
      Set parameter value of given parameter type.
      Type Parameters:
      T - Class of value.
      Parameters:
      parameterType - ParameterType<T>; the parameter type.
      value - T; new value for the parameter of type parameterType.
      Throws:
      ParameterException - If the value does not comply with value type constraints.
    • setParameterResettable

      <T> void setParameterResettable(ParameterType<T> parameterType, T value) throws ParameterException
      Set parameter value of given parameter type, store old value to allow a reset.
      Type Parameters:
      T - Class of value.
      Parameters:
      parameterType - ParameterType<T>; the parameter type.
      value - T; new value for the parameter of type parameterType.
      Throws:
      ParameterException - If the value does not comply with value type constraints.
    • resetParameter

      void resetParameter(ParameterType<?> parameterType) throws ParameterException
      Resets the parameter value to the value from before the last set. This goes only a single value back.
      Parameters:
      parameterType - ParameterType<?>; the parameter type.
      Throws:
      ParameterException - If the parameter was never set.
    • getParameter

      <T> T getParameter(ParameterType<T> parameterType) throws ParameterException
      Get parameter of given type.
      Type Parameters:
      T - Class of value.
      Parameters:
      parameterType - ParameterType<T>; the parameter type.
      Returns:
      T; parameter of the requested type if it exists
      Throws:
      ParameterException - If the parameter was never set.
    • getParameterOrNull

      <T> T getParameterOrNull(ParameterType<T> parameterType)
      Returns a parameter value, or null if not present. This can be used to prevent frequent calls to both contains() and getParameter() in performance critical code.
      Type Parameters:
      T - type of parameter value
      Parameters:
      parameterType - ParameterType<T>; parameter type
      Returns:
      parameter value, or null if not present
    • contains

      boolean contains(ParameterType<?> parameterType)
      Indicate whether the given parameter type has been set.
      Parameters:
      parameterType - ParameterType<?>; the parameter type to check
      Returns:
      boolean; true if parameterType has been set; false if parameterType has not been set
    • setAllIn

      void setAllIn(Parameters parameters)
      Sets the parameters of this set in the given set.
      Parameters:
      parameters - Parameters; parameters to set the values in