org.openrdf.elmo.sesame.iterators
Class ElmoIteration<S,E>

java.lang.Object
  extended by org.openrdf.elmo.sesame.iterators.ElmoIteration<S,E>
Type Parameters:
S - Type of the delegate (Statement)
E - Type of the result
All Implemented Interfaces:
CloseableIteration<E,ElmoException>, Iteration<E,ElmoException>, Closeable, Iterator<E>
Direct Known Subclasses:
ElmoSingleQueryResult, ElmoTupleQueryResult

public abstract class ElmoIteration<S,E>
extends Object
implements Iterator<E>, Closeable, CloseableIteration<E,ElmoException>

A general purpose iteration wrapping Sesame's iterations. This class converts the results, converts the Exceptions into ElmoRuntimeExeptions, and ensures that the iteration is closed when all values have been read (on {next()).

Author:
James Leigh

Constructor Summary
ElmoIteration(CloseableIteration<? extends S,?> delegate)
           
 
Method Summary
 void close()
           
static void close(Iterator<?> iter)
           
protected abstract  E convert(S element)
           
 boolean hasNext()
           
 E next()
           
 void remove()
           
protected  void remove(S element)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElmoIteration

public ElmoIteration(CloseableIteration<? extends S,?> delegate)
Method Detail

close

public static void close(Iterator<?> iter)

hasNext

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

next

public E next()
Specified by:
next in interface Iteration<E,ElmoException>
Specified by:
next in interface Iterator<E>

remove

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

close

public void close()
Specified by:
close in interface CloseableIteration<E,ElmoException>
Specified by:
close in interface Closeable

convert

protected abstract E convert(S element)
                      throws Exception
Throws:
Exception

remove

protected void remove(S element)
               throws Exception
Throws:
Exception


Copyright © 2004-2007. All Rights Reserved.