Module io.github.mmm.ui.spi.core
Package io.github.mmm.ui.spi.range
Class NumericRange<V extends Number>
- java.lang.Object
-
- io.github.mmm.base.range.AbstractRange<V>
-
- io.github.mmm.ui.spi.range.NumericRange<V>
-
- Type Parameters:
V
- type of the contained values.
- All Implemented Interfaces:
Range<V>
,WritableRange<V>
public class NumericRange<V extends Number> extends AbstractRange<V> implements WritableRange<V>
Implementation ofWritableRange
forUiNumericInput
.- Since:
- 1.0.0
-
-
Field Summary
-
Fields inherited from interface io.github.mmm.base.range.Range
BOUND_END_EXCLUSIVE, BOUND_END_INCLUSIVE, BOUND_SEPARATOR, BOUND_START_EXCLUSIVE, BOUND_START_INCLUSIVE, MAX_UNBOUND, MIN_UNBOUND, PROPERTY_MAX, PROPERTY_MIN
-
-
Constructor Summary
Constructors Constructor Description NumericRange(NumberType<V> type)
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description V
fromFactor(double factor)
V
getMax()
V
getMin()
protected void
onValueChange()
void
setMax(V max)
void
setMin(V min)
void
setValidator(Validator<? super V> validator)
double
toFactor(V value)
-
Methods inherited from class io.github.mmm.base.range.AbstractRange
equals, hashCode, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.github.mmm.base.range.Range
clip, contains, getComparator
-
-
-
-
Constructor Detail
-
NumericRange
public NumericRange(NumberType<V> type)
The constructor.- Parameters:
type
- theNumberType
.
-
-
Method Detail
-
getMin
public V getMin()
-
setMin
public void setMin(V min)
- Specified by:
setMin
in interfaceWritableRange<V extends Number>
- Parameters:
min
- the new value ofRange.getMin()
.
-
getMax
public V getMax()
-
setMax
public void setMax(V max)
- Specified by:
setMax
in interfaceWritableRange<V extends Number>
- Parameters:
max
- the new value ofRange.getMax()
.
-
setValidator
public void setValidator(Validator<? super V> validator)
- Parameters:
validator
- theValidator
to apply.
-
fromFactor
public V fromFactor(double factor)
- Parameters:
factor
- the scaled value in the range from0
to1
.- Returns:
- the value within this range scaled by the given
factor
. It will bemin
in case the givenfactor
is0
, while0
is used in casemin
isnull
. In case thefactor
is1
, it will returnmax
or the maximum value instead ofnull
. Any other factor is interpolated betweenmin
andmax
.
-
toFactor
public double toFactor(V value)
-
onValueChange
protected void onValueChange()
-
-