Class PageRange


  • public class PageRange
    extends java.lang.Object
    Represents a range of page indices within a document. Indices start at 0.
    • Constructor Summary

      Constructors 
      Constructor Description
      PageRange​(int totalNumPages)
      Creates a new page range.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      PageRange all()
      Select each page in order from beginning to end.
      int[] asIndices()
      Return the selected indices as an array.
      PageRange complex​(java.lang.String complexString)
      Select indices as specified in the selection string.
      boolean isEveryPage()  
      PageRange range​(int startIndex, int endIndex)
      Select all pages within the given range.
      PageRange single​(int selectedIndex)
      Select a single page.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • PageRange

        public PageRange​(int totalNumPages)
        Creates a new page range.
        Parameters:
        totalNumPages - The total number of pages in document to which this range refers. Must be at least 1.
        Throws:
        java.lang.IllegalArgumentException - If less than one page.
    • Method Detail

      • all

        public PageRange all()
        Select each page in order from beginning to end.
        Returns:
        This object again, for convenience.
      • single

        public PageRange single​(int selectedIndex)
        Select a single page.
        Parameters:
        selectedIndex - The desired page index (0-based).
        Returns:
        This object again, for convenience.
      • complex

        public PageRange complex​(java.lang.String complexString)
        Select indices as specified in the selection string. For example: "1, 10, 3, 5 - 7, 2" will select page indices [0, 9, 2, 4, 5, 6, 1].
        Parameters:
        complexString - The selection string.
        Returns:
        This object again, for convenience.
      • range

        public PageRange range​(int startIndex,
                               int endIndex)
        Select all pages within the given range.
        Parameters:
        startIndex - The index to start from.
        endIndex - The final index (inclusive).
        Returns:
        This object again, for convenience.
      • asIndices

        public int[] asIndices()
        Return the selected indices as an array.
        Returns:
        int[] containing the selected indices in order.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isEveryPage

        public boolean isEveryPage()