public class LazyMutableClosableIteration extends Object implements CloseableIteration<BindingSet,QueryEvaluationException>
CloseableIteration
that allows repetitive iterations after resetting the cursor using
resetCursor()
.
Note that the inner iteration is lazily consumed.
Modifier and Type | Field and Description |
---|---|
protected List<BindingSet> |
consumed |
protected int |
cursorIdx
the cursor index, is used after the inner iteration is fully consumed
|
protected CloseableIteration<BindingSet,QueryEvaluationException> |
inner |
Constructor and Description |
---|
LazyMutableClosableIteration(CloseableIteration<BindingSet,QueryEvaluationException> inner) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this iteration, freeing any resources that it is holding.
|
boolean |
hasNext()
Returns true if the iteration has more elements.
|
BindingSet |
next()
Returns the next element in the iteration.
|
void |
remove()
Removes from the underlying collection the last element returned by the iteration (optional operation).
|
void |
resetCursor()
Reset the cursor to read from the already consumed bindings.
|
protected final CloseableIteration<BindingSet,QueryEvaluationException> inner
protected List<BindingSet> consumed
protected volatile int cursorIdx
public LazyMutableClosableIteration(CloseableIteration<BindingSet,QueryEvaluationException> inner)
public boolean hasNext() throws QueryEvaluationException
Iteration
Iteration.next()
would return an element rather than throwing a NoSuchElementException.)hasNext
in interface Iteration<BindingSet,QueryEvaluationException>
QueryEvaluationException
public BindingSet next() throws QueryEvaluationException
Iteration
next
in interface Iteration<BindingSet,QueryEvaluationException>
QueryEvaluationException
public void remove() throws QueryEvaluationException
Iteration
remove
in interface Iteration<BindingSet,QueryEvaluationException>
QueryEvaluationException
public void close() throws QueryEvaluationException
CloseableIteration
close
in interface AutoCloseable
close
in interface CloseableIteration<BindingSet,QueryEvaluationException>
QueryEvaluationException
public void resetCursor()
Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.