Class LongIntervalSequenceIterator

  • All Implemented Interfaces:
    LazyLongIterator

    public class LongIntervalSequenceIterator
    extends java.lang.Object
    implements LazyLongIterator
    An iterator returning the integers contained in a sequence of intervals.
    • Constructor Summary

      Constructors 
      Constructor Description
      LongIntervalSequenceIterator​(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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long nextLong()
      The next long returned by this iterator, or the special marker if this iterator is exhausted.
      long skip​(long 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

      • 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 as left) 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 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

      • 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 interface LazyLongIterator
        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 interface LazyLongIterator
        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).