public class PageRange extends Object
Encapsulates one page range, which can have open or closed bounds. By default is "fully open" - it includes all existing pages. Page numbering starts from 1, not from 0.
| Modifier and Type | Field and Description |
|---|---|
static PageRange |
AllPages
Represents all existing pages of a document.
|
| Constructor and Description |
|---|
PageRange() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(PageRange other)
Detects whether this instance of PageRange is equal to specified
|
static PageRange |
fromBeginningWithCount(int pageCount)
Creates a page range, that starts from the first page and has specified amount of pages
|
static PageRange |
fromStartPageTillEnd(int startPageNumber)
Creates a page range, that starts from the specified page number and continues till the end of the document
|
static PageRange |
fromStartPageTillEndPage(int startPageNumber,
int endPageNumber)
Creates a page range, that starts from the specified page number (inclusively) and continues until the specified page number (exclusively)
|
static PageRange |
fromStartPageWithCount(int startPageNumber,
int pageCount)
Creates a page range, that starts from the specified page number and has specified amount of pages, or unlimited page count (till the end)
|
int |
getCount()
Numbers of pages within range.
|
int |
getEndNumber()
Exclusive end page number, until which this page range continues and on which is stops exclusively.
|
int |
getStartNumber()
Inclusive start page number, from which this page range starts.
|
boolean |
isDefault()
Indicates whether this instance represents a default "fully open" page range i.e.
|
public static final PageRange AllPages
Represents all existing pages of a document. Default value.
public final boolean equals(PageRange other)
Detects whether this instance of PageRange is equal to specified
other - Other PageRange instance to check on equalitypublic static PageRange fromBeginningWithCount(int pageCount)
Creates a page range, that starts from the first page and has specified amount of pages
pageCount - Number of pages, must be strictly bigger than zeropublic static PageRange fromStartPageTillEnd(int startPageNumber)
Creates a page range, that starts from the specified page number and continues till the end of the document
startPageNumber - Page number, from which page range starts, inclusively. Page numbers are 1-based, so must be strictly bigger than zeropublic static PageRange fromStartPageTillEndPage(int startPageNumber, int endPageNumber)
Creates a page range, that starts from the specified page number (inclusively) and continues until the specified page number (exclusively)
startPageNumber - Page number, from which page range starts, inclusively. Page numbers are 1-based, so must be strictly bigger than zeroendPageNumber - Page number, until which page range continues, exclusively. Page numbers are 1-based, so must be strictly bigger than zero, and also must be strictly greater than startPageNumberpublic static PageRange fromStartPageWithCount(int startPageNumber, int pageCount)
Creates a page range, that starts from the specified page number and has specified amount of pages, or unlimited page count (till the end)
startPageNumber - Page number, from which page range starts, inclusively. Page numbers are 1-based, so must be strictly bigger than zeropageCount - Number of pages, must be strictly bigger than zero. If zero - this means all pages till the end of a documentpublic final int getCount()
Numbers of pages within range. If 0 - page range spreads until end of the document no matter how much pages it consists of
public final int getEndNumber()
Exclusive end page number, until which this page range continues and on which is stops exclusively. If 0 - page range spreads until end of the document
public final int getStartNumber()
Inclusive start page number, from which this page range starts. If 1 - page range starts from the first page of a document
public final boolean isDefault()
Indicates whether this instance represents a default "fully open" page range i.e. it consists all pages of a document
Copyright © 2024. All rights reserved.