Class ExploreServlet.ResultCursor

  • Enclosing class:
    ExploreServlet

    protected class ExploreServlet.ResultCursor
    extends Object
    Class for keeping track of location within the result set, relative to offset and limit.
    Author:
    Dale Visser
    • Constructor Detail

      • ResultCursor

        public ResultCursor​(int offset,
                            int limit,
                            boolean render)
        Parameters:
        offset - the desired offset at which rendering should start
        limit - the desired maximum number of results to render
        render - if false, suppresses any rendering
    • Method Detail

      • getTotalResultCount

        public int getTotalResultCount()
        Gets the total number of results. Only meant to be called after advance() has been called for all results in the set.
        Returns:
        the number of times advance() has been called
      • getRenderedResultCount

        public int getRenderedResultCount()
        Gets the number of results that were actually rendered. Only meant to be called after advance() has been called for all results in the set.
        Returns:
        the number of times advance() has been called when this.mayRender() evaluated to true
      • mayRender

        public boolean mayRender()
        Returns:
        whether it is allowed to render the next result
      • advance

        public void advance()
        Advances the cursor, incrementing the total count, and moving other internal counters.