All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.molgenis.data.rest.EntityPager Maven / Gradle / Ivy

There is a newer version: 7.4.9
Show newest version
package org.molgenis.data.rest;

import org.molgenis.data.Entity;

public class EntityPager
{
	private final int start;
	private final int num;
	private final Long total;
	private final Iterable iterable;

	public EntityPager(int start, int num, Long total, Iterable iterable)
	{
		this.start = start;
		this.num = num;
		this.total = total;
		this.iterable = iterable;
	}

	public int getStart()
	{
		return start;
	}

	public int getNum()
	{
		return num;
	}

	public Long getTotal()
	{
		return total;
	}

	public Integer getNextStart()
	{
		if (total == null) return this.start + this.num;

		if (this.start + this.num > this.total - 1) return null;
		else return this.start + this.num;
	}

	public Integer getPrevStart()
	{
		if (this.start == 0) return null;
		else return this.start - this.num >= 0 ? this.start - this.num : 0;
	}

	public Iterable getIterable()
	{
		return iterable;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy