Skip to content

Commit 83a0671

Browse files
committed
added javadocs
1 parent 07a0443 commit 83a0671

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

src/main/java/com/marklogic/client/Page.java

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,66 @@
1717

1818
import java.util.Iterator;
1919

20+
/** A generic interface for pagination through large sets of items of type <T>. */
2021
public interface Page<T> extends Iterable<T> {
22+
/** An iterator over the items in this page. */
2123
public Iterator<T> iterator();
24+
25+
/** The start position of this page within all possible items. For result sets
26+
* this is the position of the first result within the result set.
27+
* @return the start position
28+
*/
2229
public long getStart();
30+
31+
/** The page size which is the maximum number of items allowed in one page.
32+
* @return the page size */
2333
public long getPageSize();
34+
35+
/** The total count (potentially an estimate) of all possible items in the set.
36+
* For result sets this is the number of items within the result set.
37+
* For search result sets this is the estimated number of matching items.
38+
* @return the total count of possible items */
2439
public long getTotalSize();
40+
41+
/** The count of items in this page, which is always less than getPageSize().
42+
* If ({@link #getTotalSize()} - {@link #getStart()}) &gt; {@link #getPageSize()}
43+
* then size() == getPageSize().
44+
* @return the count of items in this page
45+
*/
2546
public long size();
47+
48+
49+
/** The number of pages covering all possible items.
50+
* @return the number of pages. Literally,
51+
* <pre>{@code (long) Math.ceil((double) getTotalSize() / (double) getPageSize()); }</pre>
52+
*/
2653
public long getTotalPages();
54+
55+
/** Whether there are any items in this page.
56+
* @return true if {@code size() > 0; }
57+
*/
2758
public boolean hasContent();
59+
60+
/** Whether there are any items in the next page.
61+
* @return true if {@code getPageNumber() < getTotalPages(); }
62+
*/
2863
public boolean hasNextPage();
64+
65+
/** Whether there is a previous page.
66+
* @return true if {@code getPageNumber() > 0 }
67+
*/
2968
public boolean hasPreviousPage();
69+
70+
/** The page number within the count of all possible pages.
71+
* @return {@code (long) Math.floor((double) start / (double) getPageSize()) + 1; }
72+
*/
3073
public long getPageNumber();
74+
75+
/** @return true if {@code getPageNumber() == 1 }
76+
*/
3177
public boolean isFirstPage();
78+
79+
/** @return true if {@code getPageNumber() == getTotalPages() }
80+
*/
3281
public boolean isLastPage();
3382
}

0 commit comments

Comments
 (0)