Class MathPlume.MissingNumbersIteratorLong

java.lang.Object
org.plumelib.util.MathPlume.MissingNumbersIteratorLong
All Implemented Interfaces:
Iterator<Long>
Enclosing class:
MathPlume

static final class MathPlume.MissingNumbersIteratorLong extends Object implements Iterator<Long>
This iterator returns all the numbers *not* in its argument array (which must be non-empty) but in the argument's range; that is, bigger than its argument's minimum value and smaller than its argument's maximum value. The result contains no duplicates and is in order. If boolean addEnds is set, then the bracketing endpoints are also returned; otherwise, all returned values are between the minimum and maximum of the original values.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) boolean
    If true, include the value just before the minimum excluded element and the value just after the maximum excluded element.
    (package private) @org.checkerframework.checker.index.qual.IndexFor({"nums"}) int
    Used only if nums != null, in which case it is an index into nums.
    (package private) long
    The next element to be returned by the iterator.
    (package private) long
    The current element of the numbers not to include in the iterator.
    (package private) long @MonotonicNonNull @MinLen(1) []
    The numbers not to include in the iterator.
    (package private) @MonotonicNonNull Iterator<Long>
    The numbers not to include in the iterator.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MissingNumbersIteratorLong(long @MinLen(1) [] nums, boolean addEnds)
    An iterator over all the numbers not in its original argument array, but within its range.
    MissingNumbersIteratorLong(Iterator<Long> numsItor, boolean addEnds)
    An iterator over all the numbers not in its argument iterator, but within its range.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
     
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.Iterator

    forEachRemaining
  • Field Details

    • nums

      long @MonotonicNonNull @MinLen(1) [] nums
      The numbers not to include in the iterator.
    • numsItor

      @MonotonicNonNull Iterator<Long> numsItor
      The numbers not to include in the iterator.
    • currentNonmissing

      long currentNonmissing
      The current element of the numbers not to include in the iterator.
    • currentMissing

      long currentMissing
      The next element to be returned by the iterator.
    • currentIndex

      @org.checkerframework.checker.index.qual.IndexFor({"nums"}) int currentIndex
      Used only if nums != null, in which case it is an index into nums.
    • addEnds

      boolean addEnds
      If true, include the value just before the minimum excluded element and the value just after the maximum excluded element.
  • Constructor Details

    • MissingNumbersIteratorLong

      MissingNumbersIteratorLong(long @MinLen(1) [] nums, boolean addEnds)
      An iterator over all the numbers not in its original argument array, but within its range.
      Parameters:
      nums - a non-empty array
      addEnds - if true, include the bracketing endpoints
    • MissingNumbersIteratorLong

      MissingNumbersIteratorLong(Iterator<Long> numsItor, boolean addEnds)
      An iterator over all the numbers not in its argument iterator, but within its range.
      Parameters:
      numsItor - a non-empty array; must return longs in sorted order
      addEnds - if true, include the bracketing endpoints
  • Method Details

    • hasNext

      public boolean hasNext(@GuardSatisfied MathPlume.MissingNumbersIteratorLong this)
      Specified by:
      hasNext in interface Iterator<Long>
    • next

      public Long next(@GuardSatisfied MathPlume.MissingNumbersIteratorLong this)
      Specified by:
      next in interface Iterator<Long>
    • remove

      public void remove(@GuardSatisfied MathPlume.MissingNumbersIteratorLong this)
      Specified by:
      remove in interface Iterator<Long>