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

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

public interface Range<V extends Number & Comparable<V>> extends org.refcodes.mixin.MinValueAccessor<V>, org.refcodes.mixin.MaxValueAccessor<V>
Interface describing a range with a minimum value and a maximum value.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Adds builder functionality to a Range.

    Nested classes/interfaces inherited from interface org.refcodes.mixin.MaxValueAccessor

    org.refcodes.mixin.MaxValueAccessor.MaxValueBuilder<V extends Object,B extends org.refcodes.mixin.MaxValueAccessor.MaxValueBuilder<V,B>>, org.refcodes.mixin.MaxValueAccessor.MaxValueMutator<V extends Object>, org.refcodes.mixin.MaxValueAccessor.MaxValueProperty<V extends Object>

    Nested classes/interfaces inherited from interface org.refcodes.mixin.MinValueAccessor

    org.refcodes.mixin.MinValueAccessor.MinValueBuilder<V extends Object,B extends org.refcodes.mixin.MinValueAccessor.MinValueBuilder<V,B>>, org.refcodes.mixin.MinValueAccessor.MinValueMutator<V extends Object>, org.refcodes.mixin.MinValueAccessor.MinValueProperty<V extends Object>
  • Method Summary

    Modifier and Type
    Method
    Description
    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).
    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.

    Methods inherited from interface org.refcodes.mixin.MaxValueAccessor

    getMaxValue

    Methods inherited from interface org.refcodes.mixin.MinValueAccessor

    getMinValue
  • 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.