Class LazyMutableClosableIteration
- java.lang.Object
-
- org.eclipse.rdf4j.federated.evaluation.iterator.LazyMutableClosableIteration
-
- All Implemented Interfaces:
AutoCloseable,Iterator<BindingSet>,CloseableIteration<BindingSet>
public class LazyMutableClosableIteration extends Object implements CloseableIteration<BindingSet>
A specializedCloseableIterationthat allows repetitive iterations after resetting the cursor usingresetCursor().Note that the inner iteration is lazily consumed.
- Author:
- Andreas Schwarte
-
-
Field Summary
Fields Modifier and Type Field Description protected List<BindingSet>consumedprotected intcursorIdxthe cursor index, is used after the inner iteration is fully consumedprotected CloseableIteration<BindingSet>inner
-
Constructor Summary
Constructors Constructor Description LazyMutableClosableIteration(CloseableIteration<BindingSet> inner)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this iteration, freeing any resources that it is holding.booleanhasNext()BindingSetnext()voidremove()voidresetCursor()Reset the cursor to read from the already consumed bindings.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.rdf4j.common.iteration.CloseableIteration
stream
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Field Detail
-
inner
protected final CloseableIteration<BindingSet> inner
-
consumed
protected List<BindingSet> consumed
-
cursorIdx
protected volatile int cursorIdx
the cursor index, is used after the inner iteration is fully consumed
-
-
Constructor Detail
-
LazyMutableClosableIteration
public LazyMutableClosableIteration(CloseableIteration<BindingSet> inner)
-
-
Method Detail
-
hasNext
public boolean hasNext() throws QueryEvaluationException- Specified by:
hasNextin interfaceIterator<BindingSet>- Throws:
QueryEvaluationException
-
next
public BindingSet next() throws QueryEvaluationException
- Specified by:
nextin interfaceIterator<BindingSet>- Throws:
QueryEvaluationException
-
remove
public void remove() throws QueryEvaluationException- Specified by:
removein interfaceIterator<BindingSet>- Throws:
QueryEvaluationException
-
close
public void close() throws QueryEvaluationExceptionDescription copied from interface:CloseableIterationCloses this iteration, freeing any resources that it is holding. If the iteration has already been closed then invoking this method has no effect.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseableIteration<BindingSet>- Throws:
QueryEvaluationException
-
resetCursor
public void resetCursor()
Reset the cursor to read from the already consumed bindings.
-
-