it.unimi.dsi.webgraph
Class IntIntervalSequenceIterator

java.lang.Object
  extended by 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
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
 int nextInt()
          The next integer returned by this iterator, or the special marker if this iterator is exhausted.
 int skip(int n)
          Skips a given number of elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 as left) 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 as left) containing the number of integers (greater than zero) in each interval.
n - the number of valid entries in left and len.
Method Detail

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 interface LazyIntIterator
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 interface LazyIntIterator
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).