Interface NumberRange<N extends Number & Comparable<?>>

Type Parameters:
N - type of the contained Number values.
All Superinterfaces:
Range<N>
All Known Implementing Classes:
NumberRangeBean, NumberRangeType

public interface NumberRange<N extends Number & Comparable<?>> extends Range<N>
Extends Range for Number types.
  • Method Details

    • getType

      default NumberType<N> getType()
      Returns:
      the NumberType of this range. May be null if unbounded.
    • wrap

      default N wrap(N value)
      This method wraps the given value so the result is contained in this Range unless the given value is null.
      Parameters:
      value - is the vale to clip. May be null.
      Returns:
      the given value wrapped to this range.
    • clip

      default N clip(N value, boolean wrap)
      Parameters:
      value - is the vale to clip. May be null.
      wrap - - true for wrap(Number), false for Range.clip(Comparable).
      Returns:
      clip if wrap was false and wrap otherwise (if wrap was true).
    • fromFactor

      default N 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

      default double toFactor(N 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.