Class IntVar

  • Direct Known Subclasses:
    BooleanVar

    public class IntVar
    extends IntExpr
    The class IntVar is a subset of IntExpr. In addition to the
    IntExpr protocol, it offers persistence, removing values from the domains,
    and a finer model for events.
    • Constructor Detail

      • IntVar

        protected IntVar​(long cPtr,
                         boolean cMemoryOwn)
    • Method Detail

      • getCPtr

        protected static long getCPtr​(IntVar obj)
      • swigRelease

        protected static long swigRelease​(IntVar obj)
      • finalize

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

        public void delete()
        Overrides:
        delete in class IntExpr
      • isVar

        public boolean isVar()
        Description copied from class: IntExpr
        Returns true if the expression is indeed a variable.
        Overrides:
        isVar in class IntExpr
      • var

        public IntVar var()
        Description copied from class: IntExpr
        Creates a variable from the expression.
        Overrides:
        var in class IntExpr
      • value

        public long value()
        This method returns the value of the variable. This method checks
        before that the variable is bound.
      • removeValue

        public void removeValue​(long v)
        This method removes the value 'v' from the domain of the variable.
      • removeInterval

        public void removeInterval​(long l,
                                   long u)
        This method removes the interval 'l' .. 'u' from the domain of
        the variable. It assumes that 'l' <= 'u'.
      • removeValues

        public void removeValues​(long[] values)
        This method remove the values from the domain of the variable.
      • setValue

        public void setValue​(long[] values)
        This method intersects the current domain with the values in the array.
      • whenBound

        public void whenBound​(Demon d)
        This method attaches a demon that will be awakened when the
        variable is bound.
      • whenBound

        public void whenBound​(java.lang.Runnable closure)
        This method attaches a closure that will be awakened when the
        variable is bound.
      • whenDomain

        public void whenDomain​(Demon d)
        This method attaches a demon that will watch any domain
        modification of the domain of the variable.
      • whenDomain

        public void whenDomain​(java.lang.Runnable closure)
        This method attaches a closure that will watch any domain
        modification of the domain of the variable.
      • size

        public java.math.BigInteger size()
        This method returns the number of values in the domain of the variable.
      • contains

        public boolean contains​(long v)
        This method returns whether the value 'v' is in the domain of the
        variable.
      • makeHoleIterator

        public IntVarIterator makeHoleIterator​(boolean reversible)
        Creates a hole iterator. When 'reversible' is false, the returned
        object is created on the normal C++ heap and the solver does NOT
        take ownership of the object.
      • makeDomainIterator

        public IntVarIterator makeDomainIterator​(boolean reversible)
        Creates a domain iterator. When 'reversible' is false, the
        returned object is created on the normal C++ heap and the solver
        does NOT take ownership of the object.
      • oldMin

        public long oldMin()
        Returns the previous min.
      • oldMax

        public long oldMax()
        Returns the previous max.
      • varType

        public int varType()
      • isEqual

        public IntVar isEqual​(long constant)
        IsEqual
      • isDifferent

        public IntVar isDifferent​(long constant)
      • isGreaterOrEqual

        public IntVar isGreaterOrEqual​(long constant)
      • isLessOrEqual

        public IntVar isLessOrEqual​(long constant)
      • index

        public int index()
        Returns the index of the variable.