org.jrdf.graph.local.iterator
Class ResourceIterator<E>

java.lang.Object
  extended by org.jrdf.graph.local.iterator.ResourceIterator<E>
All Implemented Interfaces:
Iterator<E>, ClosableIterator<E>
Direct Known Subclasses:
AnyResourceIterator, URIReferenceResourceIterator

public abstract class ResourceIterator<E>
extends Object
implements ClosableIterator<E>


Field Summary
protected  boolean firstTime
           
protected  Iterator<Map.Entry<Long,Map<Long,Set<Long>>>> iterator012
           
protected  Iterator<Map.Entry<Long,Map<Long,Set<Long>>>> iterator201
           
protected  LongIndex longIndex012
           
protected  Resource nextResource
           
protected  NodePool nodePool
           
protected  ResourceFactory resourceFactory
           
 
Constructor Summary
ResourceIterator(LongIndex[] newLongIndexes, ResourceFactory newResourceFactory, NodePool newNodePool)
           
 
Method Summary
 boolean close()
          Closes the iterator by freeing any resources that it current holds.
protected abstract  long getNextNodeId(Iterator<Map.Entry<Long,Map<Long,Set<Long>>>> iterator)
          Provides a customizable way in which to filter out resource nodes based on type.
protected  Resource getNextResource()
           
 boolean hasNext()
           
 void remove()
           
 
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
next
 

Field Detail

longIndex012

protected final LongIndex longIndex012

resourceFactory

protected final ResourceFactory resourceFactory

iterator012

protected Iterator<Map.Entry<Long,Map<Long,Set<Long>>>> iterator012

iterator201

protected Iterator<Map.Entry<Long,Map<Long,Set<Long>>>> iterator201

nextResource

protected Resource nextResource

firstTime

protected boolean firstTime

nodePool

protected NodePool nodePool
Constructor Detail

ResourceIterator

public ResourceIterator(LongIndex[] newLongIndexes,
                        ResourceFactory newResourceFactory,
                        NodePool newNodePool)
Method Detail

close

public boolean close()
Description copied from interface: ClosableIterator
Closes the iterator by freeing any resources that it current holds.

This must be done as soon as possible. Once an iterator is closed none of the operations on a iterator will operate i.e. they will throw an exception.

Specified by:
close in interface ClosableIterator<E>
Returns:
true if it was successfully closed.

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<E>

remove

public void remove()
Specified by:
remove in interface Iterator<E>

getNextResource

protected Resource getNextResource()

getNextNodeId

protected abstract long getNextNodeId(Iterator<Map.Entry<Long,Map<Long,Set<Long>>>> iterator)
Provides a customizable way in which to filter out resource nodes based on type.

Parameters:
iterator - iterators over the index.
Returns:
the next node identifier.