org.neo4j.index.impl.lucene
Class IdToEntityIterator<T extends PropertyContainer>

java.lang.Object
  extended by org.neo4j.helpers.collection.PrefetchingIterator<T>
      extended by org.neo4j.helpers.collection.CatchingIteratorWrapper<T,Long>
          extended by org.neo4j.index.impl.lucene.IdToEntityIterator<T>
All Implemented Interfaces:
Iterable<T>, Iterator<T>, IndexHits<T>

public abstract class IdToEntityIterator<T extends PropertyContainer>
extends CatchingIteratorWrapper<T,Long>
implements IndexHits<T>


Constructor Summary
IdToEntityIterator(IndexHits<Long> ids)
           
 
Method Summary
 void close()
          Closes the underlying search result.
 float currentScore()
          Returns the score of the most recently fetched item from this iterator (from Iterator.next()).
protected  boolean exceptionOk(Throwable t)
           
protected  Long fetchNextOrNullFromSource(Iterator<Long> source)
           
 T getSingle()
          Returns the first and only item from the result iterator, or null if there was none.
 Iterator<T> iterator()
           
 int size()
          Returns the size of this iterable, in most scenarios this value is accurate while in some scenarios near-accurate.
 
Methods inherited from class org.neo4j.helpers.collection.CatchingIteratorWrapper
fetchNextOrNull, itemDodged, underlyingObjectToObject
 
Methods inherited from class org.neo4j.helpers.collection.PrefetchingIterator
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 java.util.Iterator
hasNext, next, remove
 

Constructor Detail

IdToEntityIterator

public IdToEntityIterator(IndexHits<Long> ids)
Method Detail

exceptionOk

protected boolean exceptionOk(Throwable t)
Overrides:
exceptionOk in class CatchingIteratorWrapper<T extends PropertyContainer,Long>

fetchNextOrNullFromSource

protected Long fetchNextOrNullFromSource(Iterator<Long> source)
Overrides:
fetchNextOrNullFromSource in class CatchingIteratorWrapper<T extends PropertyContainer,Long>

currentScore

public float currentScore()
Description copied from interface: IndexHits
Returns the score of the most recently fetched item from this iterator (from Iterator.next()). The range of the returned values is up to the Index implementation to dictate.

Specified by:
currentScore in interface IndexHits<T extends PropertyContainer>
Returns:
the score of the most recently fetched item from this iterator.

size

public int size()
Description copied from interface: IndexHits
Returns the size of this iterable, in most scenarios this value is accurate while in some scenarios near-accurate. There's no cost in calling this method. It's considered near-accurate if this IndexHits object has been returned when inside a Transaction which has index modifications, of a certain nature. Also entities (Nodes/Relationships) which have been deleted from the graph, but are still in the index will also affect the accuracy of the returned size.

Specified by:
size in interface IndexHits<T extends PropertyContainer>
Returns:
the near-accurate size if this iterable.

iterator

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

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 extends PropertyContainer>

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 extends PropertyContainer>
Returns:
the first and only item, or null if none.


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