Class NumericRange<V extends Number>

    • Constructor Detail

      • NumericRange

        public NumericRange​(NumberType<V> type)
        The constructor.
        Parameters:
        type - the NumberType.
    • Method Detail

      • getMin

        public V getMin()
        Specified by:
        getMin in interface Range<V extends Number>
        Returns:
        the lower bound of this range or null if no lower bound is defined. Has to be less than max if both boundaries are not null.
      • getMax

        public V getMax()
        Specified by:
        getMax in interface Range<V extends Number>
        Returns:
        the upper bound of this range or null if no upper bound is defined. Has to be greater than min if both boundaries are not null.
      • setValidator

        public void setValidator​(Validator<? super V> validator)
        Parameters:
        validator - the Validator to apply.
      • fromFactor

        public V fromFactor​(double factor)
        Parameters:
        factor - the scaled value in the range from 0 to 1.
        Returns:
        the value within this range scaled by the given factor. It will be min in case the given factor is 0, while 0 is used in case min is null. In case the factor is 1, it will return max or the maximum value instead of null. Any other factor is interpolated between min and max.
      • toFactor

        public double toFactor​(V value)
        Parameters:
        value - the value within this range.
        Returns:
        the scaled value. It will be min in case the given factor is 0, while 0 is used in case min is null. In case the factor is 1, it will return max or the maximum value instead of null. Any other factor is interpolated between min and max.
      • onValueChange

        protected void onValueChange()
        Called whenever min or max changes.