/** * Retrieves the value of this double property according to these rules. * * <ul> * <li>If the property has no value, returns the default value.</li> * <li>If there is no default value and {@link #minValue} <= 0.0 <= * {@link #maxValue}, returns 0.0.</li> * <li>If there is no default value and 0.0 is not in the min/max range, * returns {@link #minValue}.</li> * </ul> */ public double get() { final String value = getInternal(null, false); if (value == null) { return noValue(); } double v = Double.parseDouble(value); return limit(v); }
/** * Sets the value of this double property. The value is limited to the * min/max range given during construction. * * @return the previous value, or if not set: the default value. If no * default value exists, 0.0 if that value is in the range [minValue, * maxValue], or minValue if 0.0 is not in the range */ public double set(double value) { String prevValue = setString(Double.toString(limit(value))); if (prevValue == null) { prevValue = getDefaultValue(); if (prevValue == null) { return noValue(); } } double v = Double.parseDouble(prevValue); return limit(v); }