Class PagingInfo


  • public class PagingInfo
    extends Object
    An abstraction that represents paging concept. Also offer utilities that assist paging calculations.
    Author:
    simonpai
    • Constructor Detail

      • PagingInfo

        public PagingInfo​(int dataSize)
        Construct a PagingInfo with start = 0 and no limit. This is equivalent to waiving the page concept. We introduce this generalization for a better tree traversal logic and a potential extension on column paging.
      • PagingInfo

        public PagingInfo​(int start,
                          int limit,
                          int dataSize)
        Construct a PagingInfo with start index and limit.
    • Method Detail

      • getDataSize

        public int getDataSize()
        Get data size on this rank.
      • getStart

        public int getStart()
        Get start index of current page.
      • getLimit

        public int getLimit()
        Get page size. Negative value means no limit.
      • getEnd

        public int getEnd()
        Get the end index of this page, exclusively. For example, if start = 3, limit = 5, then last index in range is 7 and end = 8.
      • isLimited

        public boolean isLimited()
        Return true if the paging has a limit
      • getNodeStart

        public int getNodeStart()
        Get the start index of node rather then entries. They are mostly different as long as data size is greater than one.
      • getNodeLimit

        public int getNodeLimit()
        Get the number of nodes involved in current page, including those partially shown. Does not concern whether current page is the last page.
      • getNodeEnd

        public int getNodeEnd()
        Get the end index of node, exclusively.
      • getCutoffStart

        public int getCutoffStart()
        Return how many entries under the first node is cut off.
      • getNaiveCutoffEnd

        public int getNaiveCutoffEnd()
        Return how many entries under the last node is cut off. Does not concern whether current page is the last page.
      • getRealCutoffEnd

        public int getRealCutoffEnd​(int realNodeSize)
        Return how many entries under the last node is cut off. If the current page is last page, the value will surely be 0.
        Parameters:
        realNodeSize - the real number of nodes involved in this page. As we do not know anything about the tree, we have to pass in this information to know the real cut-off value.
      • getPagedSize

        public int getPagedSize​(int size)
        Return row/column numbers cropped by paging.