Package it.unimi.dsi.sux4j.util
Class EliasFanoIndexedMonotoneLongBigList.EliasFanoIndexedMonotoneLongBigListIterator
java.lang.Object
it.unimi.dsi.sux4j.util.EliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator
it.unimi.dsi.sux4j.util.EliasFanoIndexedMonotoneLongBigList.EliasFanoIndexedMonotoneLongBigListIterator
- All Implemented Interfaces:
BidirectionalIterator<Long>
,BigListIterator<Long>
,LongBidirectionalIterator
,LongBigListIterator
,LongIterator
,ObjectBidirectionalIterator<Long>
,ObjectIterator<Long>
,Iterator<Long>
,PrimitiveIterator<Long,
,LongConsumer> PrimitiveIterator.OfLong
- Enclosing class:
- EliasFanoIndexedMonotoneLongBigList
public final class EliasFanoIndexedMonotoneLongBigList.EliasFanoIndexedMonotoneLongBigListIterator
extends EliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator
An list iterator over the values of this
EliasFanoIndexedMonotoneLongBigList
Besides the features of an
EliasFanoMonotoneLongBigListIterator
, instance of this class provide a skipTo(long)
method that implements the same fast logic of
EliasFanoIndexedMonotoneLongBigList.successor(long)
.
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.PrimitiveIterator
PrimitiveIterator.OfDouble, PrimitiveIterator.OfInt, PrimitiveIterator.OfLong
-
Field Summary
Fields inherited from class it.unimi.dsi.sux4j.util.EliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator
index, lowerBitsPosition, window, word
-
Method Summary
Modifier and TypeMethodDescriptionlong
nextLong()
long
Returns the same element asEliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator.nextLong()
, ifEliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator.hasNext()
is true; otherwise, behavior is undefined.long
long
Returns the same element asEliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator.previousLong()
, ifEliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator.hasPrevious()
is true; otherwise, behavior is undefined.long
skipTo
(long lowerBound) Moves this iterator to the first element greater than or equal to the provided bound.long
skipToUnsafe
(long lowerBound) Moves this iterator to the first element greater than or equal to the provided bound without checking its argument.Methods inherited from class it.unimi.dsi.sux4j.util.EliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator
hasNext, hasPrevious, nextIndex, previousIndex
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface it.unimi.dsi.fastutil.longs.LongBidirectionalIterator
back, previous
Methods inherited from interface it.unimi.dsi.fastutil.longs.LongBigListIterator
add, add, back, set, set, skip, skip
Methods inherited from interface it.unimi.dsi.fastutil.longs.LongIterator
forEachRemaining, forEachRemaining, next
Methods inherited from interface java.util.PrimitiveIterator.OfLong
forEachRemaining
-
Field Details
-
last
protected long lastThe last returned value.
-
-
Method Details
-
nextLong
public long nextLong()- Specified by:
nextLong
in interfaceLongIterator
- Specified by:
nextLong
in interfacePrimitiveIterator.OfLong
- Overrides:
nextLong
in classEliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator
-
nextLongUnsafe
public long nextLongUnsafe()Description copied from class:EliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator
Returns the same element asEliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator.nextLong()
, ifEliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator.hasNext()
is true; otherwise, behavior is undefined.- Overrides:
nextLongUnsafe
in classEliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator
- Returns:
- the same element as
EliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator.nextLong()
, ifEliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator.hasNext()
is true; otherwise, behavior is undefined.
-
previousLong
public long previousLong()- Specified by:
previousLong
in interfaceLongBidirectionalIterator
- Overrides:
previousLong
in classEliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator
-
previousLongUnsafe
public long previousLongUnsafe()Description copied from class:EliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator
Returns the same element asEliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator.previousLong()
, ifEliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator.hasPrevious()
is true; otherwise, behavior is undefined.- Overrides:
previousLongUnsafe
in classEliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator
- Returns:
- the same element as
EliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator.previousLong()
, ifEliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator.hasPrevious()
is true; otherwise, behavior is undefined.
-
skipTo
public long skipTo(long lowerBound) Moves this iterator to the first element greater than or equal to the provided bound.- Parameters:
lowerBound
- a nonnegative lower bound.- Returns:
- the last element returned by
nextLong()
orpreviousLong()
if it is smaller than or equal tolowerBound
, in which case this method is a no-op. Otherwise, the first element among the ones that will be returned bynextLong()
that is greater than or equal tolowerBound
. The iterator will be positioned on the element (i.e., the next call tonextLong()
will return the element). In particular,EliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator.nextIndex()
returns the index of the returned element in the list. If no such element exists, this methods returnsLong.MAX_VALUE
and sets the current index to the list length. - See Also:
-
skipToUnsafe
public long skipToUnsafe(long lowerBound) Moves this iterator to the first element greater than or equal to the provided bound without checking its argument.This method is slightly faster than
skipTo(long)
as it does not check its argument.- Parameters:
lowerBound
- a nonnegative lower bound smaller than or equal to the last element of the sequence plus one.- Returns:
- the last element returned by
nextLong()
orpreviousLong()
if it is smaller than or equal tolowerBound
, in which case this method is a no-op. Otherwise, the first element among the ones that will be returned bynextLong()
that is greater than or equal tolowerBound
. The iterator will be positioned on the element (i.e., the next call tonextLong()
will return the element). In particular,EliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator.nextIndex()
returns the index of the returned element in the list. If no such element exists, this methods returns the last element of this list plus one and sets the current index to the list length. Behavior is undefined iflowerBound
is out of bounds. - See Also:
-