org.lexevs.paging
Class AbstractPageableIterator<T>

java.lang.Object
  extended by org.lexevs.paging.AbstractPageableIterator<T>
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<T>, java.util.Iterator<T>
Direct Known Subclasses:
AbstractRefereshingPageableIterator, AssociatedConceptIterator, DefaultTransitivityBuilder.TripleIterator, MappingTripleIterator, MappingTripleUidIterator, RootConceptReferenceIterator, TripleUidIterator

public abstract class AbstractPageableIterator<T>
extends java.lang.Object
implements java.util.Iterator<T>, java.lang.Iterable<T>, java.io.Serializable

The Class AbstractPageableIterator.

Author:
Kevin Peterson
See Also:
Serialized Form

Nested Class Summary
static class AbstractPageableIterator.NextDecorator<T>
          The Class NextDecorator.
static class AbstractPageableIterator.Pager<T>
          The Class Pager.
 
Constructor Summary
protected AbstractPageableIterator()
          Instantiates a new abstract pageable iterator.
  AbstractPageableIterator(int pageSize)
          Instantiates a new abstract pageable iterator.
 
Method Summary
protected  T decorateNext(T item)
          Decorate next.
protected  java.util.List<? extends T> doExecutePage()
          Do execute page.
protected abstract  java.util.List<? extends T> doPage(int currentPosition, int pageSize)
          Returns a page of results.
protected  int getGlobalPosition()
          Gets the global position.
protected  int getPageSize()
          Gets the page size.
 boolean hasNext()
           
protected  boolean isDecorateNext()
          Checks if is decorate next.
protected  boolean isPageNeeded()
          Checks if is page needed.
 java.util.Iterator<T> iterator()
           
 T next()
           
protected  void page()
          Page.
protected  void pageIfNecessary()
          Page if necessary.
 void remove()
           
protected  void setDecorateNext(boolean decorateNext)
          Sets the decorate next.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPageableIterator

protected AbstractPageableIterator()
Instantiates a new abstract pageable iterator.


AbstractPageableIterator

public AbstractPageableIterator(int pageSize)
Instantiates a new abstract pageable iterator.

Parameters:
pageSize - the page size
Method Detail

iterator

public java.util.Iterator<T> iterator()
Specified by:
iterator in interface java.lang.Iterable<T>

hasNext

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

next

public T next()
Specified by:
next in interface java.util.Iterator<T>

pageIfNecessary

protected void pageIfNecessary()
Page if necessary.


remove

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

isPageNeeded

protected boolean isPageNeeded()
Checks if is page needed.

Returns:
true, if is page needed

page

protected final void page()
Page.


doExecutePage

protected java.util.List<? extends T> doExecutePage()
Do execute page.

Returns:
the list

doPage

protected abstract java.util.List<? extends T> doPage(int currentPosition,
                                                      int pageSize)
Returns a page of results. NOTE: 'pageSize' is not binding -- it is the suggested page size. Implementing classes may return more or less than the suggested 'pageSize' parameter, although it is generally recommended to abide by the 'pageSize' parameter when possible. A null or empty list returned from this method will signify that the underlying results are exhausted and paging should halt.

Parameters:
currentPosition - the current position
pageSize - the page size
Returns:
the list

decorateNext

protected T decorateNext(T item)
Decorate next.

Parameters:
item - the item
Returns:
the t

setDecorateNext

protected void setDecorateNext(boolean decorateNext)
Sets the decorate next.

Parameters:
decorateNext - the new decorate next

isDecorateNext

protected boolean isDecorateNext()
Checks if is decorate next.

Returns:
true, if is decorate next

getPageSize

protected int getPageSize()
Gets the page size.

Returns:
the page size

getGlobalPosition

protected int getGlobalPosition()
Gets the global position.

Returns:
the global position

Copyright: (c) 2004-2006 Mayo Foundation for Medical Education and Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the triple-shield Mayo logo are trademarks and service marks of MFMER.