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 specializedCloseableIteration
that 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>
consumed
protected int
cursorIdx
the 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 void
close()
Closes this iteration, freeing any resources that it is holding.boolean
hasNext()
BindingSet
next()
void
remove()
void
resetCursor()
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:
hasNext
in interfaceIterator<BindingSet>
- Throws:
QueryEvaluationException
-
next
public BindingSet next() throws QueryEvaluationException
- Specified by:
next
in interfaceIterator<BindingSet>
- Throws:
QueryEvaluationException
-
remove
public void remove() throws QueryEvaluationException
- Specified by:
remove
in interfaceIterator<BindingSet>
- Throws:
QueryEvaluationException
-
close
public void close() throws QueryEvaluationException
Description copied from interface:CloseableIteration
Closes 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseableIteration<BindingSet>
- Throws:
QueryEvaluationException
-
resetCursor
public void resetCursor()
Reset the cursor to read from the already consumed bindings.
-
-