public abstract class DoubleConfigKey extends ConfigKey<java.lang.Double>
Static methods are provided to produce config keys with a variety of GUI options for specifying values.
Modifier | Constructor | Description |
---|---|---|
protected |
DoubleConfigKey(ConfigMeta meta,
double dflt) |
Constructor.
|
Modifier and Type | Method | Description |
---|---|---|
static DoubleConfigKey |
createSliderKey(ConfigMeta meta,
double dflt,
double lo,
double hi,
boolean log) |
Returns a key with a linear or logarithmic slider for a specifier.
|
static DoubleConfigKey |
createTextKey(ConfigMeta meta) |
Constructs a key with a text field specifier and default NaN.
|
static DoubleConfigKey |
createTextKey(ConfigMeta meta,
double dflt) |
Constructs a key with a text field specifier and an explicit default.
|
static DoubleConfigKey |
createToggleKey(ConfigMeta meta,
double fval,
double tval) |
Returns a key with a specifier that only provides a
toggle between two values.
|
static java.lang.String |
doubleToString(double dval) |
Returns a string representation of a double value.
|
static double |
stringToDouble(java.lang.String txt,
ConfigKey<?> key) |
Interprets the value of a string as a double precision number.
|
java.lang.Double |
stringToValue(java.lang.String txt) |
Decodes a string value to the value type of this key.
|
java.lang.String |
valueToString(java.lang.Double value) |
Reports a value as a string.
|
cast, createSpecifier, getDefaultValue, getMeta, getValueClass, toString
protected DoubleConfigKey(ConfigMeta meta, double dflt)
meta
- metadatadflt
- default valuepublic java.lang.String valueToString(java.lang.Double value)
ConfigKey
stringToValue(valueToString(v)).equals(v)
.
A null value, if permitted, should be represented as an empty string.valueToString
in class ConfigKey<java.lang.Double>
value
- possible value associated with this keypublic java.lang.Double stringToValue(java.lang.String txt) throws ConfigException
ConfigKey
stringToValue
in class ConfigKey<java.lang.Double>
txt
- string representation of valueConfigException
public static DoubleConfigKey createTextKey(ConfigMeta meta)
meta
- metadatapublic static DoubleConfigKey createTextKey(ConfigMeta meta, double dflt)
meta
- metadatadflt
- default valuepublic static DoubleConfigKey createToggleKey(ConfigMeta meta, double fval, double tval)
meta
- metadatafval
- value for toggle false (default)tval
- value for toggle truepublic static DoubleConfigKey createSliderKey(ConfigMeta meta, double dflt, double lo, double hi, boolean log)
meta
- metadatadflt
- default valuelo
- slider lower boundhi
- slider upper boundlog
- true for logarithmic slider scale, false for linearpublic static java.lang.String doubleToString(double dval)
dval
- double value, may be NaNpublic static double stringToDouble(java.lang.String txt, ConfigKey<?> key) throws ConfigException
txt
- string, may be nullkey
- reference key, used for error reportingConfigException
- for non-numeric stringsCopyright © 2018 Central Laboratory of the Research Councils. All Rights Reserved.