org.neo4j.index.impl.lucene
Class AbstractIndexHits<T>

java.lang.Object
  extended by org.neo4j.helpers.collection.PrefetchingIterator<T>
      extended by org.neo4j.index.impl.lucene.AbstractIndexHits<T>
All Implemented Interfaces:
Iterable<T>, Iterator<T>, IndexHits<T>
Direct Known Subclasses:
HitsIterator

public abstract class AbstractIndexHits<T>
extends PrefetchingIterator<T>
implements IndexHits<T>


Constructor Summary
AbstractIndexHits()
           
 
Method Summary
 void close()
          Closes the underlying search result.
 T getSingle()
          Returns the first and only item from the result iterator, or null if there was none.
 Iterator<T> iterator()
           
 
Methods inherited from class org.neo4j.helpers.collection.PrefetchingIterator
fetchNextOrNull, getPrefetchedNextOrNull, hasNext, next, remove, setPrefetchedNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.neo4j.graphdb.index.IndexHits
currentScore, size
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Constructor Detail

AbstractIndexHits

public AbstractIndexHits()
Method Detail

iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T>

close

public void close()
Description copied from interface: IndexHits
Closes the underlying search result. This method should be called whenever you've got what you wanted from the result and won't use it anymore. It's necessary to call it so that underlying indexes can dispose of allocated resources for this search result. You can however skip to call this method if you loop through the whole result, then close() will be called automatically. Even if you loop through the entire result and then call this method it will silently ignore any consequtive call (for convenience).

Specified by:
close in interface IndexHits<T>

getSingle

public T getSingle()
Description copied from interface: IndexHits
Returns the first and only item from the result iterator, or null if there was none. If there were more than one item in the result a NoSuchElementException will be thrown. This method must be called first in the iteration and will grab the first item from the iteration, so the result is considered broken after this call.

Specified by:
getSingle in interface IndexHits<T>
Returns:
the first and only item, or null if none.


Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.