Package it.unimi.dsi.big.webgraph
Class LongIntervalSequenceIterator
java.lang.Object
it.unimi.dsi.big.webgraph.LongIntervalSequenceIterator
- All Implemented Interfaces:
LazyLongIterator
An iterator returning the integers contained in a sequence of intervals.
-
Constructor Summary
ConstructorDescriptionLongIntervalSequenceIterator
(long[] left, long[] len) Creates a new interval-sequence iterator by specifying arrays of left extremes and lengths.LongIntervalSequenceIterator
(long[] left, long[] len, int n) Creates a new interval-sequence iterator by specifying arrays of left extremes and lengths, and the number of valid entries. -
Method Summary
-
Constructor Details
-
LongIntervalSequenceIterator
public LongIntervalSequenceIterator(long[] left, long[] len) Creates a new interval-sequence iterator by specifying arrays of left extremes and lengths. Note that the two arrays are not copied, so they are supposed not to be changed during the iteration.- Parameters:
left
- an array containing the left extremes of the intervals generating this iterator.len
- an array (of the same length asleft
) containing the number of integers (greater than zero) in each interval.
-
LongIntervalSequenceIterator
public LongIntervalSequenceIterator(long[] left, long[] len, int n) Creates a new interval-sequence iterator by specifying arrays of left extremes and lengths, and the number of valid entries. Note that the two arrays are not copied, so they are supposed not to be changed during the iteration.- Parameters:
left
- an array containing the left extremes of the intervals generating this iterator.len
- an array (of the same length asleft
) containing the number of integers (greater than zero) in each interval.n
- the number of valid entries inleft
andlen
.
-
-
Method Details
-
nextLong
public long nextLong()Description copied from interface:LazyLongIterator
The next long returned by this iterator, or the special marker if this iterator is exhausted.- Specified by:
nextLong
in interfaceLazyLongIterator
- Returns:
- next long returned by this iterator, or the special marker if this iterator is exhausted.
-
skip
public long skip(long n) Description copied from interface:LazyLongIterator
Skips a given number of elements.- Specified by:
skip
in interfaceLazyLongIterator
- Parameters:
n
- the number of elements to skip.- Returns:
- the number of elements actually skipped (which might
be less than
n
if this iterator is exhausted).
-