Class Range


  • public final class Range
    extends Object
    Provides a range data object.
    • Constructor Detail

      • Range

        public Range​(int from,
                     int to)
        Create a new range.
        Parameters:
        from - first page, inclusive
        to - last page, inclusive
      • Range

        public Range​(int from)
        Create a new range.
        Parameters:
        from - first page, inclusive
    • Method Detail

      • parseRange

        public static Range parseRange​(String range)
        Parses the string as a range.
        Parameters:
        range - the range to parse
        Returns:
        returns a Range object
        Throws:
        NumberFormatException - if the range cannot be parsed
      • inRange

        public boolean inRange​(int value)
        Test if a value is in range.
        Parameters:
        value - the value
        Returns:
        returns true if value is in range, false otherwise
      • getFrom

        public int getFrom()
        Gets the from value, inclusive.
        Returns:
        returns the from value
      • getTo

        public int getTo()
        Gets the to value, inclusive.
        Returns:
        returns the to value
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object