Class InputParameterDoubleScalar<U extends Unit<U>,T extends DoubleScalar<U,T>>
java.lang.Object
nl.tudelft.simulation.dsol.model.inputparameters.AbstractInputParameter<SortedMap<String,InputParameter<?,?>>,CT>
nl.tudelft.simulation.dsol.model.inputparameters.AbstractInputParameterMap<T>
nl.tudelft.simulation.dsol.model.inputparameters.AbstractInputParameterTypedMap<T>
nl.tudelft.simulation.dsol.model.inputparameters.InputParameterDoubleScalar<U,T>
- Type Parameters:
U
- the unit typeT
- the scalar type
- All Implemented Interfaces:
Serializable
,Cloneable
,InputParameter<SortedMap<String,
InputParameter<?, ?>>, T>
public class InputParameterDoubleScalar<U extends Unit<U>,T extends DoubleScalar<U,T>>
extends AbstractInputParameterTypedMap<T>
InputParameterDoubleScalar: double parameter with a unit. The number and the value are stored in an InputParameterMap as two
input variables of type InputFieldDouble (name: value), and InputFieldUnit (name: unit).
Copyright (c) 2003-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information www.simulation.tudelft.nl. The source code and binary code of this software is proprietary information of Delft University of Technology.
Copyright (c) 2003-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information www.simulation.tudelft.nl. The source code and binary code of this software is proprietary information of Delft University of Technology.
- Author:
- Alexander Verbraeck
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class nl.tudelft.simulation.dsol.model.inputparameters.AbstractInputParameterMap
AbstractInputParameterMap.InputParameterComparator
-
Field Summary
Fields inherited from class nl.tudelft.simulation.dsol.model.inputparameters.AbstractInputParameterTypedMap
typedValue
-
Constructor Summary
ConstructorDescriptionInputParameterDoubleScalar
(String key, String shortName, String description, T defaultValue, double displayPriority) Construct a new InputParameterDoubleScalar.InputParameterDoubleScalar
(String key, String shortName, String description, T defaultValue, double minimumValueSI, double maximumValueSI, boolean minIncluded, boolean maxIncluded, String format, double displayPriority) Construct a new InputParameterDoubleScalar.InputParameterDoubleScalar
(String key, String shortName, String description, T defaultValue, T minimumValue, T maximumValue, boolean minIncluded, boolean maxIncluded, String format, double displayPriority) Construct a new InputParameterDoubleScalar. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Provide the clone() method to make a deep copy.boolean
boolean
void
Construct the scalar value with reflection, and set it as the current value.void
setMaximumValueSI
(double maximumValueSI) void
setMaxIncluded
(boolean maxIncluded) void
setMinimumValueSI
(double minimumValueSI) void
setMinIncluded
(boolean minIncluded) Methods inherited from class nl.tudelft.simulation.dsol.model.inputparameters.AbstractInputParameterTypedMap
getCalculatedValue, getDefaultTypedValue
Methods inherited from class nl.tudelft.simulation.dsol.model.inputparameters.AbstractInputParameterMap
add, get, getSortedSet, printValues, printValues, remove
Methods inherited from class nl.tudelft.simulation.dsol.model.inputparameters.AbstractInputParameter
getDefaultValue, getDescription, getDisplayPriority, getExtendedKey, getKey, getParent, getShortName, getValue, isReadOnly, setDefaultValue, setParent, setReadOnly, setValue, toString
-
Constructor Details
-
InputParameterDoubleScalar
public InputParameterDoubleScalar(String key, String shortName, String description, T defaultValue, double displayPriority) throws InputParameterException Construct a new InputParameterDoubleScalar.- Parameters:
key
- String; unique (within the parent's input parameter map) name of the new InputParameterDoubleUnitshortName
- String; concise description of the input parameterdescription
- String; double description of the input parameter (may use HTML markup)defaultValue
- T; 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 NaNInputParameterException
- when unit for the default value cannot be found in the unit definition
-
InputParameterDoubleScalar
public InputParameterDoubleScalar(String key, String shortName, String description, T defaultValue, T minimumValue, T maximumValue, boolean minIncluded, boolean maxIncluded, String format, double displayPriority) throws InputParameterException Construct a new InputParameterDoubleScalar.- Parameters:
key
- String; unique (within the parent's input parameter map) name of the new InputParameterDoubleUnitshortName
- String; concise description of the input parameterdescription
- String; double description of the input parameter (may use HTML markup)defaultValue
- T; the default value of this input parameterminimumValue
- T; the lowest value allowed as inputmaximumValue
- T; the highest value allowed as inputminIncluded
- boolean; is the minimum value included or excluded in the allowed interval?maxIncluded
- boolean; is the maximum value included or excluded in the allowed interval?format
- String; the format to use in displaying the doubledisplayPriority
- double; sorting order when properties are displayed to the user- Throws:
NullPointerException
- when key, shortName, defaultValue, description, format, minimumValue, maximumValue, or defaultValue is nullIllegalArgumentException
- when displayPriority is NaNInputParameterException
- when unit for the default value cannot be found in the unit definition
-
InputParameterDoubleScalar
public InputParameterDoubleScalar(String key, String shortName, String description, T defaultValue, double minimumValueSI, double maximumValueSI, boolean minIncluded, boolean maxIncluded, String format, double displayPriority) throws InputParameterException Construct a new InputParameterDoubleScalar.- Parameters:
key
- String; unique (within the parent's input parameter map) name of the new InputParameterDoubleUnitshortName
- String; concise description of the input parameterdescription
- String; double description of the input parameter (may use HTML markup)defaultValue
- T; the default value of this input parameterminimumValueSI
- double; the lowest value allowed as input (in SI units)maximumValueSI
- double; the highest value allowed as input (in SI units)minIncluded
- boolean; is the minimum value included or excluded in the allowed interval?maxIncluded
- boolean; is the maximum value included or excluded in the allowed interval?format
- String; the format to use in displaying the doubledisplayPriority
- double; sorting order when properties are displayed to the user- Throws:
NullPointerException
- when key, shortName, defaultValue, description, format, or defaultValue is nullIllegalArgumentException
- when displayPriority is NaNInputParameterException
- when unit for the default value cannot be found in the unit definition
-
-
Method Details
-
getUnitParameter
- Returns:
- the unit sub-parameter
- Throws:
RuntimeException
- when parameter map has been corrupted and no unit parameter can be found
-
getDoubleParameter
- Returns:
- the double sub-parameter
- Throws:
RuntimeException
- when parameter map has been corrupted and no value parameter can be found
-
setCalculatedValue
Construct the scalar value with reflection, and set it as the current value. The unit is specified as Unit<?> because the input using fields cannot guarantee conformance to the right unit type.- Specified by:
setCalculatedValue
in classAbstractInputParameterTypedMap<T extends DoubleScalar<U,
T>> - Throws:
InputParameterException
- when an operation is attempted that is not compatible with the indicated input parameter, or when the scalar does not have a constructor Scalar(double, unit)
-
getMinimumValueSI
- Returns:
- minimumValue (SI units)
-
setMinimumValueSI
public void setMinimumValueSI(double minimumValueSI) - Parameters:
minimumValueSI
- double; set minimumValue (SI units)
-
getMaximumValueSI
- Returns:
- maximumValue (SI units)
-
setMaximumValueSI
public void setMaximumValueSI(double maximumValueSI) - Parameters:
maximumValueSI
- double; set maximumValue (SI units)
-
isMinIncluded
public boolean isMinIncluded()- Returns:
- minIncluded
-
setMinIncluded
public void setMinIncluded(boolean minIncluded) - Parameters:
minIncluded
- boolean; set minIncluded
-
isMaxIncluded
public boolean isMaxIncluded()- Returns:
- maxIncluded
-
setMaxIncluded
public void setMaxIncluded(boolean maxIncluded) - Parameters:
maxIncluded
- boolean; set maxIncluded
-
clone
Provide the clone() method to make a deep copy.- Specified by:
clone
in interfaceInputParameter<U extends Unit<U>,
T extends DoubleScalar<U, T>> - Overrides:
clone
in classAbstractInputParameterTypedMap<T extends DoubleScalar<U,
T>> - Returns:
- a deep copy of the InputParameter
-