Class ParameterTypeInteger
java.lang.Object
org.opentrafficsim.base.Type<ParameterType<T>>
org.opentrafficsim.base.parameters.ParameterType<T>
org.opentrafficsim.base.parameters.ParameterTypeNumeric<Integer>
org.opentrafficsim.base.parameters.ParameterTypeInteger
- All Implemented Interfaces:
Serializable,Identifiable
public class ParameterTypeInteger extends ParameterTypeNumeric<Integer> implements Serializable
Wrapper class for int parameters.
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
- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ParameterTypeInteger(String id, String description)Construct a new ParameterTypeInteger without default value and check.ParameterTypeInteger(String id, String description, int defaultValue)Construct a new ParameterTypeInteger with default value, without check.ParameterTypeInteger(String id, String description, int defaultValue, Constraint<? super Integer> constraint)Construct a new ParameterTypeInteger with default value and check.ParameterTypeInteger(String id, String description, Integer defaultValue)Construct a new ParameterTypeInteger with default value, without check.ParameterTypeInteger(String id, String description, Integer defaultValue, Constraint<Number> constraint)Construct a new ParameterTypeInteger with default value and check.ParameterTypeInteger(String id, String description, Constraint<? super Integer> constraint)Construct a new ParameterTypeInteger without default value, with check. -
Method Summary
Modifier and Type Method Description voidcheck(int value, Parameters params)Method to overwrite for checks with constraints.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 Details
-
ParameterTypeInteger
Construct a new ParameterTypeInteger without default value and check.- Parameters:
id- String; short name of the new ParameterTypeIntegerdescription- String; parameter description or full name of the new ParameterTypeInteger
-
ParameterTypeInteger
Construct a new ParameterTypeInteger with default value, without check.- Parameters:
id- String; short name of the new ParameterTypeIntegerdescription- String; parameter description or full name of the new ParameterTypeIntegerdefaultValue- int; the default value of the new ParameterTypeInteger
-
ParameterTypeInteger
Construct a new ParameterTypeInteger with default value, without check.- Parameters:
id- String; short name of the new ParameterTypeIntegerdescription- String; parameter description or full name of the new ParameterTypeIntegerdefaultValue- Integer; the default value of the new ParameterTypeInteger
-
ParameterTypeInteger
Construct a new ParameterTypeInteger without default value, with check.- Parameters:
id- String; short name of the new ParameterTypeIntegerdescription- String; parameter description or full name of the new ParameterTypeIntegerconstraint- Constraint<? super Integer>; constraint for parameter values
-
ParameterTypeInteger
public ParameterTypeInteger(String id, String description, int defaultValue, Constraint<? super Integer> constraint)Construct a new ParameterTypeInteger with default value and check.- Parameters:
id- String; short name of the new ParameterTypeIntegerdescription- String; parameter description or full name of the new ParameterTypeIntegerdefaultValue- int; the default value of the new ParameterTypeIntegerconstraint- Constraint<? super Integer>; constraint for parameter values
-
ParameterTypeInteger
public ParameterTypeInteger(String id, String description, Integer defaultValue, Constraint<Number> constraint)Construct a new ParameterTypeInteger with default value and check.- Parameters:
id- String; short name of the new ParameterTypeIntegerdescription- String; parameter description or full name of the new ParameterTypeIntegerdefaultValue- Integer; the default value of the new ParameterTypeIntegerconstraint- Constraint<Number>; constraint for parameter values
-
-
Method Details
-
printValue
Print the given value from the map in Parameters in a presentable format. The default implementation simply returns the output of toString().- Overrides:
printValuein classParameterTypeNumeric<Integer>- Parameters:
parameters- Parameters; Parameters to get the value from- Returns:
- String; readable representation of the value
- Throws:
ParameterException- If the parameter is not present
-
check
Method to overwrite for checks with constraints.- Parameters:
value- int; Value to check with constraints.params- Parameters; Set of parameters.- Throws:
ParameterException- If the value does not comply with constraints.
-
toString
- Overrides:
toStringin classParameterTypeNumeric<Integer>
-