java.lang.Object
net.sacredlabyrinth.phaed.simpleclans.utils.Paginator

public class Paginator extends Object
Author:
RoinujNosde
  • Constructor Details

    • Paginator

      public Paginator(int sizePerPage, int totalElements)
    • Paginator

      public Paginator(int sizePerPage, @NotNull @NotNull Collection<?> collection)
  • Method Details

    • getTotalElements

      public int getTotalElements()
      author: RoinujNosde
      Returns:
      the total elements
    • getSizePerPage

      public int getSizePerPage()
      author: RoinujNosde
      Returns:
      the size per page
    • getMinIndex

      public int getMinIndex()
      author: RoinujNosde
      Returns:
      the minimal index based on the current page
    • getMaxIndex

      public int getMaxIndex()
      author: RoinujNosde
      Returns:
      the max index based on the current page
    • getCurrentPage

      public int getCurrentPage()
      author: RoinujNosde
      Returns:
      the current page, starting at 0
    • nextPage

      public boolean nextPage()
      Increases the page number if there are elements to display

      author: RoinujNosde

    • hasNextPage

      public boolean hasNextPage()
      Returns:
      if there is a next page
    • previousPage

      public boolean previousPage()
      Decreases the page number if current > 0

      author: RoinujNosde

    • hasPreviousPage

      public boolean hasPreviousPage()
      Returns:
      if there is a previous page
    • isValidIndex

      public boolean isValidIndex(int index)
      Parameters:
      index - the index
      Returns:
      if this index will not cause any IndexOutOfBoundsException

      author: RoinujNosde