org.jboss.cache.search
Class LazyQueryResultIterator

java.lang.Object
  extended by org.jboss.cache.search.LazyQueryResultIterator
All Implemented Interfaces:
Iterator, ListIterator, QueryResultIterator

public class LazyQueryResultIterator
extends Object
implements QueryResultIterator

Implementation for QueryResultIterator. This is what is returned when the CacheQuery.lazyIterator() method is called. This loads the results only when required and hence differs from QueryResultIteratorImpl which is the other implementation of QueryResultIterator.

Author:
Navin Surtani (nsurtani@redhat.com)

Constructor Summary
LazyQueryResultIterator(org.hibernate.search.engine.DocumentExtractor extractor, CacheEntityLoader entityLoader, org.apache.lucene.search.IndexSearcher searcher, org.hibernate.search.engine.SearchFactoryImplementor searchFactory, int first, int max, int fetchSize)
           
 
Method Summary
 void add(Object o)
          This method is not supported in and should not be called.
 void afterFirst()
          Jumps to the one-after-the-first result
 void beforeLast()
          Jumps to the one-before-the-last result
 void close()
          This method must be called on your iterator once you have finished so that Lucene resources can be freed up.
 void first()
          Jumps to the first result
 boolean hasNext()
           
 boolean hasPrevious()
           
 boolean isAfterFirst()
           
 boolean isBeforeLast()
           
 boolean isFirst()
           
 boolean isLast()
           
 void jumpToResult(int index)
          Jumps to a specific index in the iterator.
 void last()
          Jumps to the last result
 Object next()
           
 int nextIndex()
           
 Object previous()
           
 int previousIndex()
           
 void remove()
          This method is not supported and should not be used.
 void set(Object o)
          This method is not supported in and should not be called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyQueryResultIterator

public LazyQueryResultIterator(org.hibernate.search.engine.DocumentExtractor extractor,
                               CacheEntityLoader entityLoader,
                               org.apache.lucene.search.IndexSearcher searcher,
                               org.hibernate.search.engine.SearchFactoryImplementor searchFactory,
                               int first,
                               int max,
                               int fetchSize)
Method Detail

jumpToResult

public void jumpToResult(int index)
                  throws IndexOutOfBoundsException
Description copied from interface: QueryResultIterator
Jumps to a specific index in the iterator.

Specified by:
jumpToResult in interface QueryResultIterator
Parameters:
index - index to jump to.
Throws:
IndexOutOfBoundsException - if the index is out of bounds

first

public void first()
Description copied from interface: QueryResultIterator
Jumps to the first result

Specified by:
first in interface QueryResultIterator

last

public void last()
Description copied from interface: QueryResultIterator
Jumps to the last result

Specified by:
last in interface QueryResultIterator

afterFirst

public void afterFirst()
Description copied from interface: QueryResultIterator
Jumps to the one-after-the-first result

Specified by:
afterFirst in interface QueryResultIterator

beforeLast

public void beforeLast()
Description copied from interface: QueryResultIterator
Jumps to the one-before-the-last result

Specified by:
beforeLast in interface QueryResultIterator

isFirst

public boolean isFirst()
Specified by:
isFirst in interface QueryResultIterator
Returns:
true if the current result is the first

isLast

public boolean isLast()
Specified by:
isLast in interface QueryResultIterator
Returns:
true if the current result is the last

isAfterFirst

public boolean isAfterFirst()
Specified by:
isAfterFirst in interface QueryResultIterator
Returns:
true if the current result is one after the first

isBeforeLast

public boolean isBeforeLast()
Specified by:
isBeforeLast in interface QueryResultIterator
Returns:
true if the current result is one before the last

close

public void close()
Description copied from interface: QueryResultIterator
This method must be called on your iterator once you have finished so that Lucene resources can be freed up.

Specified by:
close in interface QueryResultIterator

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator
Specified by:
hasNext in interface ListIterator

next

public Object next()
Specified by:
next in interface Iterator
Specified by:
next in interface ListIterator

hasPrevious

public boolean hasPrevious()
Specified by:
hasPrevious in interface ListIterator

previous

public Object previous()
Specified by:
previous in interface ListIterator

nextIndex

public int nextIndex()
Specified by:
nextIndex in interface ListIterator

previousIndex

public int previousIndex()
Specified by:
previousIndex in interface ListIterator

remove

public void remove()
This method is not supported and should not be used. Use cache.remove() instead.

Specified by:
remove in interface Iterator
Specified by:
remove in interface ListIterator

set

public void set(Object o)
         throws UnsupportedOperationException
This method is not supported in and should not be called. Use cache.put() instead.

Specified by:
set in interface ListIterator
Parameters:
o -
Throws:
UnsupportedOperationException

add

public void add(Object o)
This method is not supported in and should not be called. Use cache.put() instead.

Specified by:
add in interface ListIterator
Parameters:
o -
Throws:
UnsupportedOperationException


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.