Class InputParameterFloatScalar<U extends Unit<U>,T extends FloatScalar<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.InputParameterFloatScalar<U,T>
- Type Parameters:
U
- the unit typeT
- the scalar type
- All Implemented Interfaces:
Serializable
,Cloneable
,InputParameter<SortedMap<String,
InputParameter<?, ?>>, T>
public class InputParameterFloatScalar<U extends Unit<U>,T extends FloatScalar<U,T>>
extends AbstractInputParameterTypedMap<T>
InputParameterFloatScalar: float parameter with a unit. The number and the value are stored in an InputParameterMap as two
input variables of type InputFieldFloat (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
ConstructorDescriptionInputParameterFloatScalar
(String key, String shortName, String description, T defaultValue, double displayPriority) Construct a new InputParameterFloatScalar.InputParameterFloatScalar
(String key, String shortName, String description, T defaultValue, float minimumValueSI, float maximumValueSI, boolean minIncluded, boolean maxIncluded, String format, double displayPriority) Construct a new InputParameterFloatScalar.InputParameterFloatScalar
(String key, String shortName, String description, T defaultValue, T minimumValue, T maximumValue, boolean minIncluded, boolean maxIncluded, String format, double displayPriority) Construct a new InputParameterFloatScalar. -
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
(float maximumValueSI) void
setMaxIncluded
(boolean maxIncluded) void
setMinimumValueSI
(float 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
-
InputParameterFloatScalar
public InputParameterFloatScalar(String key, String shortName, String description, T defaultValue, double displayPriority) throws InputParameterException Construct a new InputParameterFloatScalar.- Parameters:
key
- String; unique (within the parent's input parameter map) name of the new InputParameterFloatUnitshortName
- String; concise description of the input parameterdescription
- String; float 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
-
InputParameterFloatScalar
public InputParameterFloatScalar(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 InputParameterFloatScalar.- Parameters:
key
- String; unique (within the parent's input parameter map) name of the new InputParameterFloatUnitshortName
- String; concise description of the input parameterdescription
- String; float 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 floatdisplayPriority
- 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
-
InputParameterFloatScalar
public InputParameterFloatScalar(String key, String shortName, String description, T defaultValue, float minimumValueSI, float maximumValueSI, boolean minIncluded, boolean maxIncluded, String format, double displayPriority) throws InputParameterException Construct a new InputParameterFloatScalar.- Parameters:
key
- String; unique (within the parent's input parameter map) name of the new InputParameterFloatUnitshortName
- String; concise description of the input parameterdescription
- String; float description of the input parameter (may use HTML markup)defaultValue
- T; the default value of this input parameterminimumValueSI
- float; the lowest value allowed as input (in SI units)maximumValueSI
- float; 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 floatdisplayPriority
- 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
-
getFloatParameter
- Returns:
- the float 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 FloatScalar<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(float, unit)
-
getMinimumValueSI
- Returns:
- minimumValue (SI units)
-
setMinimumValueSI
public void setMinimumValueSI(float minimumValueSI) - Parameters:
minimumValueSI
- float; set minimumValue (SI units)
-
getMaximumValueSI
- Returns:
- maximumValue (SI units)
-
setMaximumValueSI
public void setMaximumValueSI(float maximumValueSI) - Parameters:
maximumValueSI
- float; 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 FloatScalar<U, T>> - Overrides:
clone
in classAbstractInputParameterTypedMap<T extends FloatScalar<U,
T>> - Returns:
- a deep copy of the InputParameter
-