class CollatingUniqueAmetysObjectIterable.CollatingIterator extends Object implements AmetysObjectIterator<A>
Modifier and Type | Field and Description |
---|---|
private Set<String> |
_identifiers
The already resolved identifiers.
|
private int |
_itCount
The iterable count.
|
private List<AmetysObjectIterator<A>> |
_its |
private ArrayList<A> |
_nextObjects
Next objects peeked from each iterator. |
private BitSet |
_nextObjectSet
Whether or not each object has been prefetched.
|
private long |
_position
The current position in the iterator.
|
private long |
_size |
Constructor and Description |
---|
CollatingIterator(List<AmetysObjectIterator<A>> its,
long size) |
Modifier and Type | Method and Description |
---|---|
private void |
_clear(int iterableIndex)
Clears the
_nextObjects and _nextObjectSet attributes
at position i. |
private void |
_initialize()
Initializes the collating state if it hasn't been already.
|
private int |
_least()
Returns the index of the least element in
_nextObjects ,
setting any uninitialized values. |
private boolean |
_setNextObject(int iterableIndex)
Sets the
_nextObjects and _nextObjectSet attributes
at position i to the next value of the
iterator at position i, or
clear them if the ith iterator
has no next value. |
long |
getPosition()
Returns the current position within the iterator.
|
long |
getSize()
Returns the number of elements in the iterator.
|
boolean |
hasNext() |
A |
next() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
skip
forEachRemaining, remove
private long _position
private ArrayList<A extends AmetysObject> _nextObjects
Next
objects peeked from each iterator.private BitSet _nextObjectSet
private Set<String> _identifiers
private int _itCount
private List<AmetysObjectIterator<A extends AmetysObject>> _its
private long _size
public CollatingIterator(List<AmetysObjectIterator<A>> its, long size)
public long getPosition()
AmetysObjectIterator
next
call.
getPosition
in interface AmetysObjectIterator<A extends AmetysObject>
public long getSize()
AmetysObjectIterator
getSize
in interface AmetysObjectIterator<A extends AmetysObject>
public boolean hasNext()
hasNext
in interface Iterator<A extends AmetysObject>
public A next() throws NoSuchElementException
next
in interface Iterator<A extends AmetysObject>
NoSuchElementException
private void _initialize()
private boolean _setNextObject(int iterableIndex)
_nextObjects
and _nextObjectSet
attributes
at position i to the next value of the
iterator
at position i, or
clear them if the ith iterator
has no next value.iterableIndex
- The index to get in _iterablesprivate void _clear(int iterableIndex)
_nextObjects
and _nextObjectSet
attributes
at position i.iterableIndex
- The index to clear in _iterablesprivate int _least()
_nextObjects
,
setting
any uninitialized values.IllegalStateException
- if an error occurred