Package org.ametys.plugins.repository
Class CollatingUniqueAmetysObjectIterable.CollatingIterator
- java.lang.Object
- 
- org.ametys.plugins.repository.CollatingUniqueAmetysObjectIterable.CollatingIterator
 
- 
- All Implemented Interfaces:
- Iterator<A>,- AmetysObjectIterator<A>
 - Enclosing class:
- CollatingUniqueAmetysObjectIterable<A extends AmetysObject>
 
 class CollatingUniqueAmetysObjectIterable.CollatingIterator extends Object implements AmetysObjectIterator<A> 
- 
- 
Field SummaryFields Modifier and Type Field Description private Set<String>_identifiersThe already resolved identifiers.private int_itCountThe iterable count.private List<AmetysObjectIterator<A>>_itsprivate ArrayList<A>_nextObjectsNextobjects peeked from each iterator.private BitSet_nextObjectSetWhether or not each object has been prefetched.private long_positionThe current position in the iterator.private long_size
 - 
Constructor SummaryConstructors Constructor Description CollatingIterator(List<AmetysObjectIterator<A>> its, long size)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description private void_clear(int iterableIndex)Clears the_nextObjectsand_nextObjectSetattributes 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,settingany uninitialized values.private boolean_setNextObject(int iterableIndex)Sets the_nextObjectsand_nextObjectSetattributes at position i to the next value of theiteratorat position i, or clear them if the ith iterator has no next value.longgetPosition()Returns the current position within the iterator.longgetSize()Returns the number of elements in the iterator.booleanhasNext()Anext()- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.ametys.plugins.repository.AmetysObjectIteratorskip
 - 
Methods inherited from interface java.util.IteratorforEachRemaining, remove
 
- 
 
- 
- 
- 
Field Detail- 
_positionprivate long _position The current position in the iterator.
 - 
_nextObjectsprivate ArrayList<A extends AmetysObject> _nextObjects Nextobjects peeked from each iterator.
 - 
_nextObjectSetprivate BitSet _nextObjectSet Whether or not each object has been prefetched.
 - 
_identifiersprivate Set<String> _identifiers The already resolved identifiers.
 - 
_itCountprivate int _itCount The iterable count.
 - 
_itsprivate List<AmetysObjectIterator<A extends AmetysObject>> _its 
 - 
_sizeprivate long _size 
 
- 
 - 
Constructor Detail- 
CollatingIteratorpublic CollatingIterator(List<AmetysObjectIterator<A>> its, long size) 
 
- 
 - 
Method Detail- 
getPositionpublic long getPosition() Description copied from interface:AmetysObjectIteratorReturns the current position within the iterator. The number returned is the 0-based index of the next element in the iterator, i.e. the one that will be returned on the subsequentnextcall.
 Note that this method does not check if there is a next element, i.e. an empty iterator will always return 0.- Specified by:
- getPositionin interface- AmetysObjectIterator<A extends AmetysObject>
- Returns:
- a long
 
 - 
getSizepublic long getSize() Description copied from interface:AmetysObjectIteratorReturns the number of elements in the iterator. If this information is unavailable, returns -1.- Specified by:
- getSizein interface- AmetysObjectIterator<A extends AmetysObject>
- Returns:
- a long
 
 - 
hasNextpublic boolean hasNext() - Specified by:
- hasNextin interface- Iterator<A extends AmetysObject>
 
 - 
nextpublic A next() throws NoSuchElementException - Specified by:
- nextin interface- Iterator<A extends AmetysObject>
- Throws:
- NoSuchElementException
 
 - 
_initializeprivate void _initialize() Initializes the collating state if it hasn't been already.
 - 
_setNextObjectprivate boolean _setNextObject(int iterableIndex) Sets the_nextObjectsand_nextObjectSetattributes at position i to the next value of theiteratorat position i, or clear them if the ith iterator has no next value.- Parameters:
- iterableIndex- The index to get in _iterables
- Returns:
- falseif there was no value to set
 
 - 
_clearprivate void _clear(int iterableIndex) Clears the_nextObjectsand_nextObjectSetattributes at position i.- Parameters:
- iterableIndex- The index to clear in _iterables
 
 - 
_leastprivate int _least() Returns the index of the least element in_nextObjects,settingany uninitialized values.- Returns:
- the index of the least element
- Throws:
- IllegalStateException- if an error occurred
 
 
- 
 
-