Interface Range<V extends Number & Comparable<V>>

Type Parameters:
V - The type used for the values.
All Superinterfaces:
MaxValueAccessor<V>, MinValueAccessor<V>
All Known Subinterfaces:
Range.RangeBuilder<V>
All Known Implementing Classes:
RangeImpl, RangeImpl.RangeBuilderImpl

public interface Range<V extends Number & Comparable<V>> extends MinValueAccessor<V>, MaxValueAccessor<V>
Interface describing a range with a minimum value and a maximum value.
  • Method Details

    • toRange

      static <V extends Number & Comparable<V>> Range<V> toRange(String aRange, Class<V> aType)
      Creates a Range from the provided String using a - (minus) symbol to separate the minimum from the maximum, e.g. "1-10" for a range between 1 and 10.
      Parameters:
      aRange - The String representation of the range.
      aType - The targeted type for the Range instance.
      Returns:
      The according Range instance.
    • isMember

      default boolean isMember(V aValue)
      Returns true if the given value is within the range of MinValueAccessor.getMinValue() and MaxValueAccessor.getMaxValue() (including the minimum and maximum values).
      Parameters:
      aValue - The value to test whether it is in range.
      Returns:
      True in case of being in range, else false.