Package nl.tno.imb.mc
Class ModelParameters
- java.lang.Object
-
- nl.tno.imb.mc.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 Summary
Constructors Constructor Description ModelParameters(TByteBuffer payload)Construct ModelParameters from a IMB ByteBuffer
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddParameter(Parameter parameter)Add a parameter.ParametergetParameterByName(java.lang.String name)Retrieve the parameter with a specified namejava.util.List<java.lang.String>getParameterNames()Retrieve the names of all stored parameters.Parameter.ParameterTypegetParameterType(java.lang.String name)Retrieve the type of a parameter.java.lang.ObjectgetParameterValue(java.lang.String name)Retrieve the value of a parameter.booleanparameterExists(java.lang.String name)Report if this ModelParameters object contains a parameter with the specified name.voidprepare(TByteBuffer payload)Perform the prepare operation.voidqWrite(TByteBuffer payload)Perform the qWrite operation.java.lang.StringtoString()
-
-
-
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 IMBExceptionRetrieve 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:
preparein interfaceSelfWrapper- 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:
qWritein interfaceSelfWrapper- Parameters:
payload- TByteBuffer; the buffer on which to apply the qWrite operation
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-