Package org.intermine.client.results
Class Page
- java.lang.Object
-
- org.intermine.client.results.Page
-
public final class Page extends java.lang.Object
Object representing a page parameter. A description of a web-service request page has two properties, start and size. The default page is one starting at the beginning and with the maximum available size. This class also has facilities for advancing between pages.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Page
advance(int steps)
Advance to a new page my a given number of steps.boolean
equals(java.lang.Object other)
Page
first()
Get the first page.java.lang.Integer
getSize()
Get the maximum size of this page.int
getStart()
Get the start index of this page.int
hashCode()
Page
last(int total)
Get the last page.Page
next()
Get the next page.
-
-
-
Field Detail
-
DEFAULT
public static final Page DEFAULT
The default page size (from the beginning to the maximum page size)
-
-
Constructor Detail
-
Page
public Page(int start, int size)
Construct a new page, specifying a start point and a size.- Parameters:
start
- The index of the first result to retrieve.size
- The maximum size of the page of results you want back.
-
Page
public Page(int start)
Construct a new page, specifying a start point.- Parameters:
start
- The index of the first result to retrieve.
-
-
Method Detail
-
getStart
public int getStart()
Get the start index of this page.- Returns:
- The index.
-
getSize
public java.lang.Integer getSize()
Get the maximum size of this page.- Returns:
- the size.
-
advance
public Page advance(int steps)
Advance to a new page my a given number of steps. If this is the first page, and2
is given as an argument, an object representing the third page will be returned. The new page will have the same size, but an adjusted starting point. The adjusted starting point will never be negative. Negative arguments can be given to go back. An argument of 0 will return the caller.- Parameters:
steps
- The number of pages to advance.1
gives the next page.- Returns:
- A new page, or this page, if the argument is
0
.
-
first
public Page first()
Get the first page. The new page will have the same size as this page, but a starting position of0
.- Returns:
- The first page.
-
next
public Page next()
Get the next page. The new page will have the same size as this page, but a starting position ofstart + size
.- Returns:
- The next page.
-
last
public Page last(int total)
Get the last page. The new page will have the same size as this page, but a starting position such thatstart + size >= total
. If this page has no size (ie. it is an open-ended page) then the caller will be returned.- Parameters:
total
- The total size of the result set.- Returns:
- A page that includes the last result row.
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-