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:
it.unimi.dsi.fastutil.BidirectionalIterator<java.lang.Long>
,it.unimi.dsi.fastutil.BigListIterator<java.lang.Long>
,it.unimi.dsi.fastutil.longs.LongBidirectionalIterator
,it.unimi.dsi.fastutil.longs.LongBigListIterator
,it.unimi.dsi.fastutil.longs.LongIterator
,it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator<java.lang.Long>
,it.unimi.dsi.fastutil.objects.ObjectIterator<java.lang.Long>
,java.util.Iterator<java.lang.Long>
,java.util.PrimitiveIterator<java.lang.Long,java.util.function.LongConsumer>
,java.util.PrimitiveIterator.OfLong
- Enclosing class:
- EliasFanoIndexedMonotoneLongBigList
public final class EliasFanoIndexedMonotoneLongBigList.EliasFanoIndexedMonotoneLongBigListIterator extends EliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator
An list iterator over the values of thisEliasFanoIndexedMonotoneLongBigList
Besides the features of an
EliasFanoMonotoneLongBigListIterator
, instance of this class provide askipTo(long)
method that implements the same fast logic ofEliasFanoIndexedMonotoneLongBigList.successor(long)
.
-
-
Field Summary
Fields Modifier and Type Field Description protected long
last
The last returned value.-
Fields inherited from class it.unimi.dsi.sux4j.util.EliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator
index, lowerBitsPosition, window, word
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
nextLong()
long
nextLongUnsafe()
Returns the same element asEliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator.nextLong()
, ifEliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIterator.hasNext()
is true; otherwise, behavior is undefined.long
previousLong()
long
previousLongUnsafe()
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
-
-
-
-
Method Detail
-
nextLong
public long nextLong()
- Specified by:
nextLong
in interfaceit.unimi.dsi.fastutil.longs.LongIterator
- Specified by:
nextLong
in interfacejava.util.PrimitiveIterator.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 interfaceit.unimi.dsi.fastutil.longs.LongBidirectionalIterator
- 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(long)
-
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:
skipTo(long)
-
-