Class Interval<T extends Comparable>

  • Type Parameters:
    T - The data type used in the interval. E.g. Double.
    All Implemented Interfaces:
    Comparable<T>

    public final class Interval<T extends Comparable>
    extends Object
    implements Comparable<T>
    An interval, defined by a minimum and maximum with respective open or closed endpoints.
    • Constructor Detail

      • Interval

        public Interval​(T minimum,
                        T maximum,
                        IntervalEndPoint minimumEndPoint,
                        IntervalEndPoint maximumEndPoint)
        Initializes a new instance of an Interval.
        Parameters:
        minimum - The minimum value in the interval.
        maximum - The maximum value in the interval.
        minimumEndPoint - The end point type for the minimum value.
        maximumEndPoint - The end point type for the maximum value.
      • Interval

        public Interval()
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getMaximum

        public T getMaximum()
        Gets the maximum interval value.
        Returns:
        The maximum value in the interval.
      • setMaximum

        public void setMaximum​(T value)
        Sets the maximum interval value.
        Parameters:
        value - The maximum value in the interval.
      • getMaximumEndPoint

        public IntervalEndPoint getMaximumEndPoint()
        Gets the end point type for the maximum value of the interval.
      • setMaximumEndPoint

        public void setMaximumEndPoint​(IntervalEndPoint value)
        Sets the end point type for the maximum value of the interval.
      • getMinimum

        public T getMinimum()
        Gets the minimum interval value.
        Returns:
        The minimum value in the interval.
      • setMinimum

        public void setMinimum​(T value)
        Sets the minimum interval value.
        Parameters:
        value - The minimum value in the interval.
      • getMinimumEndPoint

        public IntervalEndPoint getMinimumEndPoint()
        Gets the end point type for the minimum value of the interval.
      • setMinimumEndPoint

        public void setMinimumEndPoint​(IntervalEndPoint value)
        Sets the end point type for the minimum value of the interval.
      • contains

        public boolean contains​(T value)
        Determines whether a value is within this interval.
        Parameters:
        value - The value to check.
        Returns:
        true if the value is contained in the interval, false otherwise.