public final class PageRangeUtils extends Object
Modifier and Type | Method and Description |
---|---|
static PageRange |
asAbsoluteRange(PageRange pageRange,
int pageCount) |
static PageRange[] |
computePrintedPages(PageRange[] requestedPages,
PageRange[] writtenPages,
int pageCount) |
static boolean |
contains(PageRange[] pageRanges,
int pageIndex)
Gets whether page ranges contains a given page.
|
static boolean |
contains(PageRange[] ourRanges,
PageRange[] otherRanges,
int pageCount)
Checks whether one page range array contains another one.
|
static int |
getNormalizedPageCount(PageRange[] pageRanges,
int layoutPageCount)
Gets the number of pages in a normalized range array.
|
static boolean |
isAllPages(PageRange pageRange) |
static boolean |
isAllPages(PageRange[] pageRanges) |
static boolean |
isAllPages(PageRange[] pageRanges,
int pageCount) |
static boolean |
isAllPages(PageRange pageRanges,
int pageCount) |
static PageRange[] |
normalize(PageRange[] pageRanges)
Normalizes a page range, which is the resulting page ranges are
non-overlapping with the start lesser than or equal to the end
and ordered in an ascending order.
|
static void |
offset(PageRange[] pageRanges,
int offset)
Offsets a the start and end of page ranges with the given value.
|
static PageRange[] |
parsePageRanges(CharSequence s,
int maxPageNumber)
Parse a string into an array of page ranges.
|
public static boolean contains(PageRange[] pageRanges, int pageIndex)
pageRanges
- The page ranges.pageIndex
- The page for which to check.public static boolean contains(PageRange[] ourRanges, PageRange[] otherRanges, int pageCount)
ourRanges
- The container page ranges.otherRanges
- The contained page ranges.pageCount
- The total number of pages.public static PageRange[] normalize(PageRange[] pageRanges)
pageRanges
- The page ranges to normalize.public static PageRange[] parsePageRanges(CharSequence s, int maxPageNumber)
s
- The string to parsemaxPageNumber
- The highest page number to accept.public static void offset(PageRange[] pageRanges, int offset)
pageRanges
- The page ranges to offset.offset
- The offset value.public static int getNormalizedPageCount(PageRange[] pageRanges, int layoutPageCount)
pageRanges
- Normalized page ranges.layoutPageCount
- Page count after reported after layout pass.public static boolean isAllPages(PageRange[] pageRanges)
public static boolean isAllPages(PageRange pageRange)
public static boolean isAllPages(PageRange[] pageRanges, int pageCount)
public static boolean isAllPages(PageRange pageRanges, int pageCount)