Interface Range<T extends java.lang.Number>

  • Type Parameters:
    T - The type of bound

    public interface Range<T extends java.lang.Number>
    Represents a range. The type is unbounded such that optional minima and maxima can be used.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  Range.Factory
      Generates specific implementations of the Range interface.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      static Range<java.lang.Double> doubleRange​(@Nullable java.lang.Double min, @Nullable java.lang.Double max)
      Builds a Range based on doubles.
      static Range<java.lang.Float> floatRange​(@Nullable java.lang.Float min, @Nullable java.lang.Float max)
      Builds a Range based on floats.
      static Range<java.lang.Integer> intRange​(@Nullable java.lang.Integer min, @Nullable java.lang.Integer max)
      Builds a Range based on integers.
      @Nullable T max()
      Gets the maximum, if it exists.
      @Nullable T min()
      Gets the minimum, if it exists.
    • Method Detail

      • floatRange

        static Range<java.lang.Float> floatRange​(@Nullable java.lang.Float min,
                                                 @Nullable java.lang.Float max)
        Builds a Range based on floats.
        Parameters:
        min - The minimum, or null for no minimum
        max - The maximum, or null for no maximum
        Returns:
        The range.
      • intRange

        static Range<java.lang.Integer> intRange​(@Nullable java.lang.Integer min,
                                                 @Nullable java.lang.Integer max)
        Builds a Range based on integers.
        Parameters:
        min - The minimum, or null for no minimum
        max - The maximum, or null for no maximum
        Returns:
        The range.
        Throws:
        java.lang.IllegalArgumentException - if min is smaller than max
      • doubleRange

        static Range<java.lang.Double> doubleRange​(@Nullable java.lang.Double min,
                                                   @Nullable java.lang.Double max)
        Builds a Range based on doubles.
        Parameters:
        min - The minimum, or null for no minimum
        max - The maximum, or null for no maximum
        Returns:
        The range.
      • min

        @Nullable T min()
        Gets the minimum, if it exists.
        Returns:
        The minimum.
      • max

        @Nullable T max()
        Gets the maximum, if it exists.
        Returns:
        The maximum