Class IntExpr
- java.lang.Object
-
- com.google.ortools.constraintsolver.BaseObject
-
- com.google.ortools.constraintsolver.PropagationBaseObject
-
- com.google.ortools.constraintsolver.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 protectedIntExpr(long cPtr, boolean cMemoryOwn)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(ModelVisitor visitor)Accepts the given visitor.booleanbound()Returns true if the min and the max of the expression are equal.voiddelete()protected voidfinalize()protected static longgetCPtr(IntExpr obj)booleanisVar()Returns true if the expression is indeed a variable.longmax()longmin()voidrange(long[] l, long[] u)By default calls Min() and Max(), but can be redefined when Min and Max
code can be factorized.voidsetMax(long m)voidsetMin(long m)voidsetRange(long l, long u)This method sets both the min and the max of the expression.voidsetValue(long v)This method sets the value of the expression.protected static longswigRelease(IntExpr obj)IntVarvar()Creates a variable from the expression.IntVarvarWithName(java.lang.String name)Creates a variable from the expression and set the name of the
resulting var.voidwhenRange(Demon d)Attach a demon that will watch the min or the max of the expression.voidwhenRange(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.PropagationBaseObject
baseName, enqueueDelayedDemon, enqueueVar, freezeQueue, getCPtr, hasName, name, reset_action_on_fail, set_variable_to_clean_on_fail, setName, solver, swigRelease, toString, unfreezeQueue
-
Methods inherited from class com.google.ortools.constraintsolver.BaseObject
getCPtr, swigRelease
-
-
-
-
Method Detail
-
getCPtr
protected static long getCPtr(IntExpr obj)
-
swigRelease
protected static long swigRelease(IntExpr obj)
-
finalize
protected void finalize()
- Overrides:
finalizein classPropagationBaseObject
-
delete
public void delete()
- Overrides:
deletein classPropagationBaseObject
-
min
public long min()
-
setMin
public void setMin(long m)
-
max
public long max()
-
setMax
public void setMax(long m)
-
range
public void range(long[] l, long[] 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.
-
-