Class AbstractInputParameter<VT,CT>
java.lang.Object
nl.tudelft.simulation.dsol.model.inputparameters.AbstractInputParameter<VT,CT>
- Type Parameters:
VT
- Value type of the input parameterCT
- Calculated type of the input parameter (often the same as VT, except in complex maps)
- All Implemented Interfaces:
Serializable
,Cloneable
,InputParameter<VT,
CT>
- Direct Known Subclasses:
AbstractInputParameterMap
,InputParameterBoolean
,InputParameterDistContinuous
,InputParameterDistDiscrete
,InputParameterDouble
,InputParameterFloat
,InputParameterInteger
,InputParameterLong
,InputParameterSelectionList
,InputParameterSelectionMap
,InputParameterString
Abstract input parameter.
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.
$LastChangedDate: 2016-05-28 11:33:31 +0200 (Sat, 28 May 2016) $, @version $Revision: 2051 $, by $Author: averbraeck $,
initial version 18 dec. 2014
- Author:
- Peter Knoppers
- See Also:
-
Constructor Summary
ConstructorDescriptionAbstractInputParameter
(String key, String shortName, String description, VT defaultValue, double displayPriority) Construct a new AbstractInputParameter. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Provide the clone() method to make a deep copy.Retrieve the default value of the input parameter.Return a description of the input parameter (may use HTML markup).double
Display priority determines the order in which properties should be displayed.Retrieve the extended key of this AbstractInputParameter including parents with a dot-notation.getKey()
Retrieve the key of this InputParameter.Retrieve the parent input parameter.Return a short description of the input parameter.getValue()
Retrieve the current value of the input parameter.boolean
Return true if the input parameter can not be altered.void
setDefaultValue
(VT newValue) Change the default value of the input parameter.void
setParent
(AbstractInputParameterMap<?> newParent) Set the parent of this AbstractInputParameter.void
setReadOnly
(boolean readOnly) Specify if the input parameter can be altered.void
Change the value of the input parameter.toString()
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface nl.tudelft.simulation.dsol.model.inputparameters.InputParameter
getCalculatedValue
-
Constructor Details
-
AbstractInputParameter
public AbstractInputParameter(String key, String shortName, String description, VT defaultValue, double displayPriority) Construct a new AbstractInputParameter.- Parameters:
key
- String; unique (within this input parameter tree) name of the new AbstractInputParametershortName
- String; concise description of the input parameterdescription
- String; long description of the input parameter (may use HTML markup)defaultValue
- VT; the default value of this input parameterdisplayPriority
- double; sorting order when properties are displayed to the user- Throws:
NullPointerException
- when key, shortName, defaultValue, or description is nullIllegalArgumentException
- when displayPriority is NaN, or when key contains a period
-
-
Method Details
-
getKey
Retrieve the key of this InputParameter. The key is set at time of construction and it is immutable.- Specified by:
getKey
in interfaceInputParameter<VT,
CT> - Returns:
- String; the key of this InputParameter
-
getExtendedKey
Retrieve the extended key of this AbstractInputParameter including parents with a dot-notation.- Specified by:
getExtendedKey
in interfaceInputParameter<VT,
CT> - Returns:
- String; the extended key of this AbstractInputParameter
-
getValue
Retrieve the current value of the input parameter.- Specified by:
getValue
in interfaceInputParameter<VT,
CT> - Returns:
- VT; the current value of the input parameter
-
setValue
Change the value of the input parameter. This method is protected and final, so classes that extend this class must use their own method to set the value (e.g., setDoubleValue(...)), which has to call, in turn, super.setValue(...) to make the actual setting of the value happen. In case the setValue(...) method would be non-final and public, it would be too easy to forget to call super.setValue(...).- Parameters:
newValue
- VT; the new value for the input parameter- Throws:
NullPointerException
- when newValue is nullInputParameterException
- when this InputParameter is read-only, or newValue is not valid
-
getDefaultValue
Retrieve the default value of the input parameter.- Specified by:
getDefaultValue
in interfaceInputParameter<VT,
CT> - Returns:
- VT; the default value of the input parameter
-
setDefaultValue
Change the default value of the input parameter.- Specified by:
setDefaultValue
in interfaceInputParameter<VT,
CT> - Parameters:
newValue
- VT; the new default value for the input parameter- Throws:
InputParameterException
- when this InputParameter is read-only, or newValue is not valid
-
setReadOnly
public void setReadOnly(boolean readOnly) Specify if the input parameter can be altered.- Specified by:
setReadOnly
in interfaceInputParameter<VT,
CT> - Parameters:
readOnly
- boolean; true if this input parameter can not be altered, false if this input parameter can be altered
-
getDisplayPriority
public double getDisplayPriority()Display priority determines the order in which properties should be displayed. Properties with lower values should be displayed above or before those with higher values.- Specified by:
getDisplayPriority
in interfaceInputParameter<VT,
CT> - Returns:
- double; the display priority of this InputParameter
-
getShortName
Return a short description of the input parameter.- Specified by:
getShortName
in interfaceInputParameter<VT,
CT> - Returns:
- String; a short description of the input parameter
-
getDescription
Return a description of the input parameter (may use HTML markup).- Specified by:
getDescription
in interfaceInputParameter<VT,
CT> - Returns:
- String; the description of the input parameter
-
isReadOnly
public boolean isReadOnly()Return true if the input parameter can not be altered.- Specified by:
isReadOnly
in interfaceInputParameter<VT,
CT> - Returns:
- boolean; true if this input parameter can not be altered, false if this input parameter can be altered
-
setParent
Set the parent of this AbstractInputParameter.- Parameters:
newParent
- AbstractInputParameterMap<?>; the new parent of this AbstractInputParameter
-
getParent
Retrieve the parent input parameter.- Specified by:
getParent
in interfaceInputParameter<VT,
CT> - Returns:
- the InputParameterMap that is the parent of this InputParameter (result is null if this input parameter is not contained in an InputParameterMap)
-
toString
-
clone
Provide the clone() method to make a deep copy.
-