org.jrdf.graph.mem.iterator
Class GraphIterator

java.lang.Object
  extended by org.jrdf.graph.mem.iterator.GraphIterator
All Implemented Interfaces:
Iterator<Triple>, ClosableMemIterator<Triple>, ClosableIterator<Triple>

public final class GraphIterator
extends Object
implements ClosableMemIterator<Triple>

An iterator that iterates over an entire graph. Relies on internal iterators which iterate over all entries in the first map, the maps it points to, and the sets they point to. The itemIterator is used to indicate the current position. It will always be set to return the next value until it reaches the end of the graph.

Version:
$Revision: 1045 $
Author:
Paul Gearon, Andrew Newman

Method Summary
 boolean close()
          Closes the iterator by freeing any resources that it current holds.
 boolean containsHandler(GraphHandler012 handler012, GraphHandler201 handler201, GraphHandler120 handler120)
          Return true if this iterator contains any of the handlers.
 boolean hasNext()
          Returns true if the iteration has more elements.
 Triple next()
          Returns the next element in the iteration.
 void remove()
          Implemented for java.util.Iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hasNext

public boolean hasNext()
Returns true if the iteration has more elements.

Specified by:
hasNext in interface Iterator<Triple>
Returns:
true If there is an element to be read.

next

public Triple next()
            throws NoSuchElementException
Returns the next element in the iteration.

Specified by:
next in interface Iterator<Triple>
Returns:
the next element in the iteration.
Throws:
NoSuchElementException - iteration has no more elements.

remove

public void remove()
Implemented for java.util.Iterator.

Specified by:
remove in interface Iterator<Triple>

close

public boolean close()
Closes the iterator by freeing any resources that it current holds. Nothing to be done for this class.

Specified by:
close in interface ClosableIterator<Triple>
Returns:
true indicating success.

containsHandler

public boolean containsHandler(GraphHandler012 handler012,
                               GraphHandler201 handler201,
                               GraphHandler120 handler120)
Description copied from interface: ClosableMemIterator
Return true if this iterator contains any of the handlers.

Specified by:
containsHandler in interface ClosableMemIterator<Triple>
Parameters:
handler012 - the 012 handler
handler201 - the 201 handler
handler120 - the 120 handler
Returns:
true if this iterator contains any of the given handlers.