Class IntExpr

Direct Known Subclasses:
BaseIntExpr, IntVar

public class IntExpr
extends PropagationBaseObject
The class IntExpr is the base of all integer expressions in
constraint programming.
It contains the basic protocol for an expression:
- setting and modifying its bound
- querying if it is bound
- listening to events modifying its bounds
- casting it into a variable (instance of IntVar)
  • Field Summary

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

    swigCMemOwn
  • Constructor Summary

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

    Modifier and Type Method Description
    void accept​(ModelVisitor visitor)
    Accepts the given visitor.
    boolean bound()
    Returns true if the min and the max of the expression are equal.
    void delete()  
    protected void finalize()  
    protected static long getCPtr​(IntExpr obj)  
    boolean isVar()
    Returns true if the expression is indeed a variable.
    long max()  
    long min()  
    void range​(int[] l, int[] u)
    By default calls Min() and Max(), but can be redefined when Min and Max
    code can be factorized.
    void setMax​(long m)  
    void setMin​(long m)  
    void setRange​(long l, long u)
    This method sets both the min and the max of the expression.
    void setValue​(long v)
    This method sets the value of the expression.
    IntVar var()
    Creates a variable from the expression.
    IntVar varWithName​(java.lang.String name)
    Creates a variable from the expression and set the name of the
    resulting var.
    void whenRange​(Demon d)
    Attach a demon that will watch the min or the max of the expression.
    void whenRange​(java.lang.Runnable closure)
    Attach a demon that will watch the min or the max of the expression.

    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

    • IntExpr

      protected IntExpr​(long cPtr, boolean cMemoryOwn)
  • Method Details

    • getCPtr

      protected static long getCPtr​(IntExpr obj)
    • finalize

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

      public void delete()
      Overrides:
      delete in class PropagationBaseObject
    • min

      public long min()
    • setMin

      public void setMin​(long m)
    • max

      public long max()
    • setMax

      public void setMax​(long m)
    • range

      public void range​(int[] l, int[] u)
      By default calls Min() and Max(), but can be redefined when Min and Max
      code can be factorized.
    • setRange

      public void setRange​(long l, long u)
      This method sets both the min and the max of the expression.
    • setValue

      public void setValue​(long v)
      This method sets the value of the expression.
    • bound

      public boolean bound()
      Returns true if the min and the max of the expression are equal.
    • isVar

      public boolean isVar()
      Returns true if the expression is indeed a variable.
    • var

      public IntVar var()
      Creates a variable from the expression.
    • varWithName

      public IntVar varWithName​(java.lang.String name)
      Creates a variable from the expression and set the name of the
      resulting var. If the expression is already a variable, then it
      will set the name of the expression, possibly overwriting it.
      This is just a shortcut to Var() followed by set_name().
    • whenRange

      public void whenRange​(Demon d)
      Attach a demon that will watch the min or the max of the expression.
    • whenRange

      public void whenRange​(java.lang.Runnable closure)
      Attach a demon that will watch the min or the max of the expression.
    • accept

      public void accept​(ModelVisitor visitor)
      Accepts the given visitor.