/*
 * (C) Copyright 2008 Nuxeo SAS (http://nuxeo.com/) and contributors.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * Contributors:
 *     Nuxeo - initial API and implementation
 *
 * $Id:$
 */

package org.nuxeo.ecm.platform.workflow.api.client.wfmc;

import java.util.Collection;

/**
 * Data transfer class to hold a slice of a result set of items of type E along
 * with the total number of results that could have been fetched. This is
 * especially useful for paginated results of queries for workitem instances.
 *
 * @author ogrisel
 *
 * @param <E> Type of the elements of the embedded collection of result
 */
public class ResultSlice<E> {

    final public Collection<E> slice;

    final public int firstResult;

    final public int maxResult;

    final public int totalResult;

    public ResultSlice(Collection<E> slice, int firstResult, int maxResult,
            int totalResults) {
        this.slice = slice;
        this.firstResult = firstResult;
        this.maxResult = maxResult;
        this.totalResult = totalResults;
    }

}

/*
 * (C) Copyright 2008 Nuxeo SAS (http://nuxeo.com/) and contributors.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * Contributors:
 *     Nuxeo - initial API and implementation
 *
 * $Id:$
 */

package org.nuxeo.ecm.platform.workflow.api.client.wfmc;

import java.util.List;

/**
 * Data transfer class to hold a slice of a result set of items of type E along
 * with the total number of results that could have been fetched. This is
 * especially useful for paginated results of queries for workitem instances.
 *
 * @author ogrisel
 *
 * @param <E> Type of the elements of the embedded collection of result
 */
public class ResultSlice<E> {

    final public List<E> slice;

    final public int firstResult;

    final public int maxResult;

    final public int totalResult;

    public ResultSlice(List<E> slice, int firstResult, int maxResult,
            int totalResults) {
        this.slice = slice;
        this.firstResult = firstResult;
        this.maxResult = maxResult;
        this.totalResult = totalResults;
    }

}

make result slice hold a List instead of an apriori unordered Collection of work items