Class IntVarIterator

java.lang.Object
com.google.ortools.constraintsolver.BaseObject
com.google.ortools.constraintsolver.IntVarIterator

public class IntVarIterator extends BaseObject
The class Iterator has two direct subclasses. HoleIterators
iterates over all holes, that is value removed between the
current min and max of the variable since the last time the
variable was processed in the queue. DomainIterators iterates
over all elements of the variable domain. Both iterators are not
robust to domain changes. Hole iterators can also report values outside
the current min and max of the variable.
HoleIterators should only be called from a demon attached to the
variable that has created this iterator.
IntVar* current_var;
std::unique_ptr<IntVarIterator> it(current_var->MakeHoleIterator(false));
for (const int64_t hole : InitAndGetValues(it)) {
use the hole
}
  • Field Summary

    Fields inherited from class com.google.ortools.constraintsolver.BaseObject

    swigCMemOwn
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    IntVarIterator(long cPtr, boolean cMemoryOwn)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    protected void
     
    protected static long
     
    void
    This method must be called before each loop.
    void
    This method moves the iterator to the next value.
    boolean
    ok()
    This method indicates if we can call Value() or not.
    Pretty Print.
    long
    This method returns the current value of the iterator.

    Methods inherited from class com.google.ortools.constraintsolver.BaseObject

    getCPtr

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • IntVarIterator

      protected IntVarIterator(long cPtr, boolean cMemoryOwn)
  • Method Details

    • getCPtr

      protected static long getCPtr(IntVarIterator obj)
    • finalize

      protected void finalize()
      Overrides:
      finalize in class BaseObject
    • delete

      public void delete()
      Overrides:
      delete in class BaseObject
    • init

      public void init()
      This method must be called before each loop.
    • ok

      public boolean ok()
      This method indicates if we can call Value() or not.
    • value

      public long value()
      This method returns the current value of the iterator.
    • next

      public void next()
      This method moves the iterator to the next value.
    • toString

      public String toString()
      Pretty Print.
      Overrides:
      toString in class BaseObject