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

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

There is a newer version: 8.4.5
Show newest version
package org.molgenis.data.util;

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 (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 - 2024 Weber Informatics LLC | Privacy Policy