public final class ObjectIntMultiVector.SortedDataIterator
extends java.lang.Object
implements java.util.Iterator<java.lang.Integer>
Modifier | Constructor and Description |
---|---|
protected |
ObjectIntMultiVector.SortedDataIterator()
Creates a new instance of the sorted iterator.
|
Modifier and Type | Method and Description |
---|---|
int |
currentIndex()
Returns the index of respective data array (see
getCurrentVectorDataIndex() )
of the data returned from the last call to nextInt() or next() . |
int |
currentInt()
|
int |
getCurrentVectorDataIndex()
|
ObjectIntMultiVector |
getIteratedObject()
Returns the object this iterator operates on.
|
boolean |
hasNext() |
ObjectIntMultiVector.SDIteratorIntersectionResult |
intersect(ObjectIntMultiVector.SortedDataIterator iterator)
Find the next value that is present in this iterator and the given
iterator . |
ObjectIntMultiVector.SDIteratorIntersectionResult |
intersectSkipDuplicates(ObjectIntMultiVector.SortedDataIterator iterator,
int[] frequency)
Find the next value that is present in this iterator and the given
iterator . |
java.lang.Integer |
next() |
boolean |
nextIfEqual(int value)
Returns true (and advances this iterator) if the next value in this iterator
is equal to the given
value . |
int |
nextInt()
Returns the next value as integer.
|
int |
peekNextInt()
Returns the next value as integer, but does not advance the iterator.
|
void |
remove() |
int |
skipDuplicates()
Read all items (by calling
next() ) that have the same value
as the current item. |
protected ObjectIntMultiVector.SortedDataIterator()
public boolean hasNext()
hasNext
in interface java.util.Iterator<java.lang.Integer>
public ObjectIntMultiVector getIteratedObject()
public int getCurrentVectorDataIndex() throws java.lang.IllegalStateException
public int currentIndex()
getCurrentVectorDataIndex()
)
of the data returned from the last call to nextInt()
or next()
.public int currentInt() throws java.lang.IllegalStateException
public int nextInt() throws java.util.NoSuchElementException
java.util.NoSuchElementException
- if there are no more items in this iteratorpublic int peekNextInt() throws java.util.NoSuchElementException
java.util.NoSuchElementException
- if there are no more items in this iteratorpublic boolean nextIfEqual(int value)
value
.value
- the value to checkpublic java.lang.Integer next()
next
in interface java.util.Iterator<java.lang.Integer>
public void remove()
remove
in interface java.util.Iterator<java.lang.Integer>
public int skipDuplicates() throws java.lang.IllegalStateException
next()
) that have the same value
as the current item.java.lang.IllegalStateException
- if the iterator has no current valuepublic ObjectIntMultiVector.SDIteratorIntersectionResult intersect(ObjectIntMultiVector.SortedDataIterator iterator)
iterator
.
The return value indicates whether no intersecting
items were found (and either this or the given iterator
has no more items),
or an intersecting item was found. In the later case the current item of
both iterators is the same. Note that there can be duplicate items in which
case the next call to this method will return either ObjectIntMultiVector.SDIteratorIntersectionResult.THIS_ONLY
or ObjectIntMultiVector.SDIteratorIntersectionResult.ARGUMENT_ONLY
value to indicate
that a duplicate in the respective iterator was found.iterator
- the iterator to intersect withObjectIntMultiVector.SDIteratorIntersectionResult.NONE
if one of the iterators reached last item without a matching value,
or one of the other three ObjectIntMultiVector.SDIteratorIntersectionResult
values if a value in both the iterators was found
(their current value will be the same)public ObjectIntMultiVector.SDIteratorIntersectionResult intersectSkipDuplicates(ObjectIntMultiVector.SortedDataIterator iterator, int[] frequency)
iterator
.
The return value indicates whether no intersecting
items were found (and either this or the given iterator
has no more items),
or an intersecting item was found. In the later case the current item of
both iterators is the same. Note that there can be duplicate items in which
case the next call to this method will return either ObjectIntMultiVector.SDIteratorIntersectionResult.THIS_ONLY
or ObjectIntMultiVector.SDIteratorIntersectionResult.ARGUMENT_ONLY
value to indicate
that a duplicate in the respective iterator was found. This can be avoided
if duplicates
array is passed in which case the array is filled with
the number of duplicate items in this and the given iterator
.iterator
- the iterator to intersect withfrequency
- if an array instance is provided, the first item will be set
to the number of duplicate items encountered (skipped) in this iterator
when an intersection is found and the second array item is set to the
number of duplicates in the iterator
;
this is ignored if null is passed