001/*
002 * The contents of this file are subject to the license and copyright
003 * detailed in the LICENSE and NOTICE files at the root of the source
004 * tree.
005 */
006package org.fcrepo.search.api;
007
008import com.fasterxml.jackson.annotation.JsonProperty;
009
010/**
011 * A data structure representing the pagination information associated with a {@link org.fcrepo.search.api.SearchResult}
012 *
013 * @author dbernstein
014 */
015public class PaginationInfo {
016    @JsonProperty
017    private int offset = -1;
018    @JsonProperty
019    private int maxResults = -1;
020    @JsonProperty
021    private int totalResults;
022
023    /**
024     * Default constructor
025     */
026    public PaginationInfo() { }
027
028    /**
029     * Constructor
030     *
031     * @param maxResults max results asked off
032     * @param offset     offset of the first result item
033     * @param totalResults The total number of results
034     */
035    public PaginationInfo(final int maxResults, final int offset, final int totalResults) {
036        this.maxResults = maxResults;
037        this.offset = offset;
038        this.totalResults = totalResults;
039    }
040
041    /**
042     * @return The max results of the original query
043     */
044    public int getMaxResults() {
045        return maxResults;
046    }
047
048    /**
049     * @return The offset specified by original query
050     */
051    public int getOffset() {
052        return offset;
053    }
054
055    /**
056     * @return The total number of results for this query.
057     */
058    public int getTotalResults() {
059        return this.totalResults;
060    }
061}