public class SimpleLabelAwareIterator extends java.lang.Object implements LabelAwareIterator
Modifier and Type | Field and Description |
---|---|
protected java.util.Iterator<LabelledDocument> |
currentIterator |
protected LabelsSource |
labels |
protected java.lang.Iterable<LabelledDocument> |
underlyingIterable |
Constructor and Description |
---|
SimpleLabelAwareIterator(java.lang.Iterable<LabelledDocument> iterable)
Builds LabelAwareIterator instance using Iterable object
|
SimpleLabelAwareIterator(java.util.Iterator<LabelledDocument> iterator)
Builds LabelAwareIterator instance using Iterator object
PLEASE NOTE: If instance is built using Iterator object, reset() method becomes unavailable
|
Modifier and Type | Method and Description |
---|---|
LabelsSource |
getLabelsSource()
This method returns LabelsSource instance, containing all labels derived from this iterator
|
boolean |
hasNext() |
boolean |
hasNextDocument()
This method checks, if there's more LabelledDocuments in underlying iterator
|
LabelledDocument |
next() |
LabelledDocument |
nextDocument()
This method returns next LabelledDocument from underlying iterator
|
void |
remove() |
void |
reset()
This methods resets LabelAwareIterator by creating new Iterator from Iterable internally
|
void |
shutdown() |
protected transient java.lang.Iterable<LabelledDocument> underlyingIterable
protected transient java.util.Iterator<LabelledDocument> currentIterator
protected LabelsSource labels
public SimpleLabelAwareIterator(@NonNull java.lang.Iterable<LabelledDocument> iterable)
iterable
- public SimpleLabelAwareIterator(@NonNull java.util.Iterator<LabelledDocument> iterator)
iterator
- public boolean hasNextDocument()
hasNextDocument
in interface LabelAwareIterator
public LabelledDocument nextDocument()
nextDocument
in interface LabelAwareIterator
public boolean hasNext()
hasNext
in interface java.util.Iterator<LabelledDocument>
public LabelledDocument next()
next
in interface java.util.Iterator<LabelledDocument>
public void remove()
remove
in interface java.util.Iterator<LabelledDocument>
public void shutdown()
shutdown
in interface LabelAwareIterator
public void reset()
reset
in interface LabelAwareIterator
public LabelsSource getLabelsSource()
getLabelsSource
in interface LabelAwareIterator