org.jboss.cache.search
Class QueryResultIteratorImpl

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

public class QueryResultIteratorImpl
extends Object
implements QueryResultIterator

This is the implementation class for the interface QueryResultIterator which extends ListIterator. It is what is returned when the iterator() method is run on a CacheQuery instance.

Author:
Navin Surtani (nsurtani@redhat.com)

Constructor Summary
QueryResultIteratorImpl(List<CacheEntityId> idList, CacheEntityLoader entityLoader)
           
 
Method Summary
 void add(Object o)
          This method is not supported in and should not be called.
 void afterFirst()
          Jumps to second element in the list.
 void beforeLast()
          Jumps to penultimate element in the list.
 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 first element in the list.
 boolean hasNext()
          Returns true if the list has more elements when traversing the list in the forward direction.
 boolean hasPrevious()
          Returns true if the list has more elements when traversing the list in the reverse direction.
 boolean isAfterFirst()
           
 boolean isBeforeLast()
           
 boolean isFirst()
           
 boolean isLast()
           
 void jumpToResult(int index)
          Jumps to a given index in the list of results.
 void last()
          Jumps to last element in the list.
 Object next()
          Returns the next element in the list
 int nextIndex()
          Returns the index of the element that would be returned by a subsequent call to next.
 Object previous()
          Returns the previous element in the list.
 int previousIndex()
          Returns the index of the element that would be returned by a subsequent call to previous.
 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

QueryResultIteratorImpl

public QueryResultIteratorImpl(List<CacheEntityId> idList,
                               CacheEntityLoader entityLoader)
Method Detail

jumpToResult

public void jumpToResult(int index)
                  throws IndexOutOfBoundsException
Jumps to a given index in the list of results.

Specified by:
jumpToResult in interface QueryResultIterator
Parameters:
index - to jump to
Throws:
IndexOutOfBoundsException

first

public void first()
Jumps to first element in the list.

Specified by:
first in interface QueryResultIterator

last

public void last()
Jumps to last element in the list.

Specified by:
last in interface QueryResultIterator

afterFirst

public void afterFirst()
Jumps to second element in the list.

Specified by:
afterFirst in interface QueryResultIterator

beforeLast

public void beforeLast()
Jumps to penultimate element in the list.

Specified by:
beforeLast in interface QueryResultIterator

isFirst

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

isLast

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

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()
Returns true if the list has more elements when traversing the list in the forward direction.

Specified by:
hasNext in interface Iterator
Specified by:
hasNext in interface ListIterator
Returns:
true if the list has more elements when traversing the list in the forward direction.

next

public Object next()
Returns the next element in the list

Specified by:
next in interface Iterator
Specified by:
next in interface ListIterator
Returns:
The next element in the list.

hasPrevious

public boolean hasPrevious()
Returns true if the list has more elements when traversing the list in the reverse direction.

Specified by:
hasPrevious in interface ListIterator
Returns:
true if the list iterator has more elements when traversing the list in the reverse direction

previous

public Object previous()
Returns the previous element in the list.

Specified by:
previous in interface ListIterator
Returns:
The previous element in the list.

nextIndex

public int nextIndex()
Returns the index of the element that would be returned by a subsequent call to next.

Specified by:
nextIndex in interface ListIterator
Returns:
Index of next element.

previousIndex

public int previousIndex()
Returns the index of the element that would be returned by a subsequent call to previous.

Specified by:
previousIndex in interface ListIterator
Returns:
Index of previous element.

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 © 2008 JBoss, a division of Red Hat. All Rights Reserved.