com.atlassian.user.search.page
Class AbstractPrefetchingPager

java.lang.Object
  extended bycom.atlassian.user.search.page.AbstractPrefetchingPager
All Implemented Interfaces:
java.util.Iterator, Pager
Direct Known Subclasses:
AbstractLDAPPager

public abstract class AbstractPrefetchingPager
extends java.lang.Object
implements Pager, java.util.Iterator


Field Summary
protected  int idx
           
protected  int indexOfFirstItemInCurrentPage
           
 boolean lastPage
           
static org.apache.log4j.Category log
           
 
Fields inherited from interface com.atlassian.user.search.page.Pager
EMPTY_PAGER, NO_POSITION, PRELOAD_LIMIT
 
Constructor Summary
AbstractPrefetchingPager()
           
 
Method Summary
protected abstract  java.util.List fetch(java.lang.Object element, java.util.List prefetched)
           
 java.util.List getCurrentPage()
           
 int getIndex()
           
 int getIndexOfFirstItemInCurrentPage()
           
protected  int getIndexWithinPage()
           
 boolean hasNext()
           
 boolean isEmpty()
           
 java.util.Iterator iterator()
          Use this if you want a typical iterator over the entire data.
 java.lang.Object next()
           
 void nextPage()
           
 boolean onLastPage()
           
protected abstract  void preload()
           
protected  void preload(java.util.Iterator iterator)
           
 void remove()
           
 void skipTo(int idx)
          Will run the index up to this point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static final org.apache.log4j.Category log

idx

protected int idx

indexOfFirstItemInCurrentPage

protected int indexOfFirstItemInCurrentPage

lastPage

public boolean lastPage
Constructor Detail

AbstractPrefetchingPager

public AbstractPrefetchingPager()
Method Detail

iterator

public java.util.Iterator iterator()
Description copied from interface: Pager
Use this if you want a typical iterator over the entire data.

Specified by:
iterator in interface Pager
Returns:
an Iterator for the entire result set.

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Pager

getCurrentPage

public java.util.List getCurrentPage()
Specified by:
getCurrentPage in interface Pager
Returns:
a single, preloaded page.

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator

preload

protected abstract void preload()

remove

public void remove()
Specified by:
remove in interface java.util.Iterator

preload

protected void preload(java.util.Iterator iterator)

fetch

protected abstract java.util.List fetch(java.lang.Object element,
                                        java.util.List prefetched)
                                 throws EntityException
Throws:
EntityException

nextPage

public void nextPage()
Specified by:
nextPage in interface Pager

getIndex

public int getIndex()
Specified by:
getIndex in interface Pager
Returns:
the current index position of the pager

skipTo

public void skipTo(int idx)
            throws PagerException
Description copied from interface: Pager
Will run the index up to this point. Calling Pager.getCurrentPage() will then return a page holding this index.

Specified by:
skipTo in interface Pager
Parameters:
idx - the zero-based index of the item to skip to.
Throws:
PagerException - - if the number of items in the backing data is exceeded by the index.

onLastPage

public boolean onLastPage()
Specified by:
onLastPage in interface Pager

getIndexOfFirstItemInCurrentPage

public int getIndexOfFirstItemInCurrentPage()
Specified by:
getIndexOfFirstItemInCurrentPage in interface Pager
Returns:
the index of the first item in the current page, relative to the start of the set

next

public java.lang.Object next()
Specified by:
next in interface java.util.Iterator

getIndexWithinPage

protected int getIndexWithinPage()


Copyright © 2005-2008 Atlassian Software Systems Pty Ltd. All Rights Reserved.