Class ParameterTypeNumeric<T extends Number>
- java.lang.Object
-
- org.opentrafficsim.base.Type<ParameterType<T>>
-
- org.opentrafficsim.base.parameters.ParameterType<T>
-
- org.opentrafficsim.base.parameters.ParameterTypeNumeric<T>
-
- Type Parameters:
T- Class of the value.
- All Implemented Interfaces:
Serializable,Identifiable
- Direct Known Subclasses:
ParameterTypeAcceleration,ParameterTypeDouble,ParameterTypeDuration,ParameterTypeFrequency,ParameterTypeInteger,ParameterTypeLength,ParameterTypeLinearDensity,ParameterTypeSpeed
public abstract class ParameterTypeNumeric<T extends Number> extends ParameterType<T> implements Serializable
Wrapper class for parameters of any quantity in JUnits, or double, integer, etc.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 Apr 13, 2016
- Author:
- Alexander Verbraeck, Wouter Schakel, Peter Knoppers
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.opentrafficsim.base.parameters.ParameterType
defaultValue
-
-
Constructor Summary
Constructors Constructor Description ParameterTypeNumeric(String id, String description, Class<T> valueClass)Constructor without default value and check.ParameterTypeNumeric(String id, String description, Class<T> valueClass, Constraint<? super T> constraint)Constructor without default value, with check.ParameterTypeNumeric(String id, String description, Class<T> valueClass, T defaultValue)Constructor with default value, without check.ParameterTypeNumeric(String id, String description, Class<T> valueClass, T defaultValue, Constraint<? super T> constraint)Constructor with default value and check.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringprintValue(Parameters parameters)Print the given value from the map in Parameters in a presentable format.StringtoString()-
Methods inherited from class org.opentrafficsim.base.parameters.ParameterType
check, checkConstraint, equals, getConstraint, getDefaultValue, getDescription, getId, getValueClass, hasDefaultValue, hashCode
-
-
-
-
Constructor Detail
-
ParameterTypeNumeric
public ParameterTypeNumeric(String id, String description, Class<T> valueClass)
Constructor without default value and check.- Parameters:
id- String; Short name of parameter.description- String; Parameter description or full name.valueClass- Class<T>; Class of the value.
-
ParameterTypeNumeric
public ParameterTypeNumeric(String id, String description, Class<T> valueClass, T defaultValue)
Constructor with default value, without check.- Parameters:
id- String; Short name of parameter.description- String; Parameter description or full name.valueClass- Class<T>; Class of the value.defaultValue- T; Default value.
-
ParameterTypeNumeric
public ParameterTypeNumeric(String id, String description, Class<T> valueClass, Constraint<? super T> constraint)
Constructor without default value, with check.- Parameters:
id- String; Short name of parameter.description- String; Parameter description or full name.valueClass- Class<T>; Class of the value.constraint- Constraint<? super T>; Constraint for parameter values.
-
ParameterTypeNumeric
public ParameterTypeNumeric(String id, String description, Class<T> valueClass, T defaultValue, Constraint<? super T> constraint)
Constructor with default value and check.- Parameters:
id- String; Short name of parameter.description- String; Parameter description or full name.valueClass- Class<T>; Class of the value.defaultValue- T; Default value.constraint- Constraint<? super T>; Constraint for parameter values.
-
-
Method Detail
-
printValue
public String printValue(Parameters parameters) throws ParameterException
Print the given value from the map in Parameters in a presentable format. The default implementation simply returns the output of toString().- Overrides:
printValuein classParameterType<T extends Number>- Parameters:
parameters- Parameters; Parameters to get the value from- Returns:
- String; readable representation of the value
- Throws:
ParameterException- If the parameter is not present
-
toString
public String toString()
- Overrides:
toStringin classParameterType<T extends Number>
-
-