Package it.unimi.dsi.webgraph
Class IntIntervalSequenceIterator
java.lang.Object
it.unimi.dsi.webgraph.IntIntervalSequenceIterator
- All Implemented Interfaces:
LazyIntIterator
public class IntIntervalSequenceIterator extends Object implements LazyIntIterator
An iterator returning the integers contained in a sequence of intervals.
-
Constructor Summary
Constructors Constructor Description IntIntervalSequenceIterator(int[] left, int[] len)
Creates a new interval-sequence iterator by specifying arrays of left extremes and lengths.IntIntervalSequenceIterator(int[] left, int[] 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
-
IntIntervalSequenceIterator
public IntIntervalSequenceIterator(int[] left, int[] 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.
-
IntIntervalSequenceIterator
public IntIntervalSequenceIterator(int[] left, int[] 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
-
nextInt
public int nextInt()Description copied from interface:LazyIntIterator
The next integer returned by this iterator, or the special marker if this iterator is exhausted.- Specified by:
nextInt
in interfaceLazyIntIterator
- Returns:
- next integer returned by this iterator, or the special marker if this iterator is exhausted.
-
skip
public int skip(int n)Description copied from interface:LazyIntIterator
Skips a given number of elements.- Specified by:
skip
in interfaceLazyIntIterator
- 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).
-