Class DoubleParameter
- java.lang.Object
-
- elki.utilities.optionhandling.parameters.AbstractParameter<P,T>
-
- elki.utilities.optionhandling.parameters.NumberParameter<DoubleParameter,java.lang.Double>
-
- elki.utilities.optionhandling.parameters.DoubleParameter
-
- All Implemented Interfaces:
Parameter<java.lang.Double>
public class DoubleParameter extends NumberParameter<DoubleParameter,java.lang.Double>
Parameter class for a parameter specifying a double value.- Since:
- 0.1
- Author:
- Steffi Wanka, Erich Schubert
-
-
Field Summary
-
Fields inherited from class elki.utilities.optionhandling.parameters.AbstractParameter
constraints, defaultValue, givenValue, optionalParameter, optionid
-
-
Constructor Summary
Constructors Constructor Description DoubleParameter(OptionID optionID)
Constructs a double parameter with the given optionID.DoubleParameter(OptionID optionID, double defaultValue)
Constructs a double parameter with the given optionID and default value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
doubleValue()
Get the parameter value as double.java.lang.String
getSyntax()
Returns a string representation of the parameter's type.java.lang.String
getValueAsString()
Get the value as string.boolean
grab(Parameterization config, java.util.function.DoubleConsumer consumer)
Get the parameter.protected java.lang.Double
parseValue(java.lang.Object obj)
Parse a given value into the destination type.-
Methods inherited from class elki.utilities.optionhandling.parameters.AbstractParameter
addConstraint, describeValues, getConstraints, getDefaultValue, getDefaultValueAsString, getOptionID, getValue, hasDefaultValue, isDefined, isOptional, isValid, setDefaultValue, setOptional, setValue, setValueInternal, tookDefaultValue, tryDefaultValue, validate
-
-
-
-
Constructor Detail
-
DoubleParameter
public DoubleParameter(OptionID optionID, double defaultValue)
Constructs a double parameter with the given optionID and default value.- Parameters:
optionID
- the unique optionIDdefaultValue
- the default value for this double parameter
-
DoubleParameter
public DoubleParameter(OptionID optionID)
Constructs a double parameter with the given optionID.- Parameters:
optionID
- the unique id of this parameter
-
-
Method Detail
-
getValueAsString
public java.lang.String getValueAsString()
Description copied from interface:Parameter
Get the value as string. May returnnull
- Returns:
- Value as string
-
parseValue
protected java.lang.Double parseValue(java.lang.Object obj) throws WrongParameterValueException
Description copied from class:AbstractParameter
Parse a given value into the destination type.- Specified by:
parseValue
in classAbstractParameter<DoubleParameter,java.lang.Double>
- Parameters:
obj
- Object to parse (may be a string representation!)- Returns:
- Parsed object
- Throws:
WrongParameterValueException
-
getSyntax
public java.lang.String getSyntax()
Returns a string representation of the parameter's type.- Returns:
- "<double>"
-
doubleValue
public double doubleValue()
Get the parameter value as double.- Returns:
- double value
-
grab
public boolean grab(Parameterization config, java.util.function.DoubleConsumer consumer)
Get the parameter.- Parameters:
config
- Parameterizationconsumer
- Output consumer- Returns:
true
if valid
-
-