Package nl.tno.imb.mc

Class ModelParameters

  • All Implemented Interfaces:
    SelfWrapper

    public class ModelParameters
    extends java.lang.Object
    implements SelfWrapper
    Container for a list of model parameters.
    For now this object is immutable.

    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 Oct 17, 2016
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel
    • Constructor Detail

      • ModelParameters

        public ModelParameters​(TByteBuffer payload)
                        throws IMBException
        Construct ModelParameters from a IMB ByteBuffer
        Parameters:
        payload - TByteBuffer;
        Throws:
        IMBException
    • Method Detail

      • getParameterByName

        public Parameter getParameterByName​(java.lang.String name)
        Retrieve the parameter with a specified name
        Parameters:
        name - String; name of the parameter to look up
        Returns:
        Parameter; the parameter with the specified name, or null if no parameter with the specified name exists in this ModelParameters object
      • getParameterNames

        public java.util.List<java.lang.String> getParameterNames()
        Retrieve the names of all stored parameters. The returned object is a deep copy and may be modified by the caller.
        Returns:
        List<String>; the names of all stored parameters
      • parameterExists

        public boolean parameterExists​(java.lang.String name)
        Report if this ModelParameters object contains a parameter with the specified name.
        Parameters:
        name - String; name of the parameter
        Returns:
        boolean; true if such a parameter exists; false if such a parameter does not exist
      • getParameterType

        public Parameter.ParameterType getParameterType​(java.lang.String name)
                                                 throws IMBException
        Retrieve the type of a parameter.
        Parameters:
        name - String; name of the parameter
        Returns:
        Parameter.ParameterType; the type of the parameter
        Throws:
        IMBException - when no parameter with the specified name exists in this ModelParameters object
      • getParameterValue

        public java.lang.Object getParameterValue​(java.lang.String name)
                                           throws IMBException
        Retrieve the value of a parameter.
        Parameters:
        name - String; name of the parameter
        Returns:
        Object; the value of the parameter
        Throws:
        IMBException - when no parameter with the specified name exists in this ModelParameters object
      • addParameter

        public boolean addParameter​(Parameter parameter)
        Add a parameter. The name of the parameter must be unique.
        Parameters:
        parameter - Parameter; Parameter
        Returns:
        boolean; true if the parameter was added
      • prepare

        public void prepare​(TByteBuffer payload)
        Perform the prepare operation.
        Specified by:
        prepare in interface SelfWrapper
        Parameters:
        payload - TByteBuffer; the buffer to prepare for reception of the object that implements this interface
      • qWrite

        public void qWrite​(TByteBuffer payload)
        Perform the qWrite operation.
        Specified by:
        qWrite in interface SelfWrapper
        Parameters:
        payload - TByteBuffer; the buffer on which to apply the qWrite operation
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object