public interface IntVar
Modifier and Type | Method and Description |
---|---|
boolean |
contains(int v)
Returns true if the domain contains the specified value.
|
int |
fillArray(int[] dest)
Copies the values of the domain into an array.
|
void |
fix(int v)
Fix the specified value
|
Solver |
getSolver()
Returns the solver in which this variable was created.
|
boolean |
isFixed()
Returns true if the domain of the variable has a single value.
|
int |
max()
Returns the maximum of the domain of the variable
|
int |
min()
Returns the minimum of the domain of the variable
|
void |
propagateOnBoundChange(Constraint c)
Asks that
Constraint.propagate() is called whenever the
bound (maximum or minimum values) of the domain
of this variable is changes. |
void |
propagateOnDomainChange(Constraint c)
Asks that
Constraint.propagate() is called whenever the domain
of this variable changes. |
void |
propagateOnFix(Constraint c)
Asks that
Constraint.propagate() is called whenever the domain
of this variable is reduced to a singleton. |
void |
remove(int v)
Removes the specified value.
|
void |
removeAbove(int v)
Remove all the values above a given value
|
void |
removeBelow(int v)
Remove all the values less than a given value
|
int |
size()
Returns the size of the domain of the variable
|
void |
whenBoundChange(Procedure f)
Asks that the closure is called whenever
the max or min setValue of the domain of this variable changes
|
void |
whenDomainChange(Procedure f)
Asks that the closure is called whenever the domain change
of this variable changes
|
void |
whenFixed(Procedure f)
Asks that the closure is called whenever the domain
of this variable is reduced to a single setValue
|
Solver getSolver()
void whenFixed(Procedure f)
f
- the closurevoid whenBoundChange(Procedure f)
f
- the closurevoid whenDomainChange(Procedure f)
f
- the closurevoid propagateOnDomainChange(Constraint c)
Constraint.propagate()
is called whenever the domain
of this variable changes.
We say that a change event occurs.c
- the constraint for which the Constraint.propagate()
method should be called on change events of this variable.void propagateOnFix(Constraint c)
Constraint.propagate()
is called whenever the domain
of this variable is reduced to a singleton.
In such a state the variable is fixed and we say that a fix event occurs.c
- the constraint for which the Constraint.propagate()
method should be called on fix events of this variable.void propagateOnBoundChange(Constraint c)
Constraint.propagate()
is called whenever the
bound (maximum or minimum values) of the domain
of this variable is changes.
We say that a bound change event occurs in this case.c
- the constraint for which the Constraint.propagate()
method should be called on bound change events of this variable.int min()
int max()
int size()
int fillArray(int[] dest)
dest
- an array large enough dest.length >= size()
dest[0,...,size-1]
contains
the values in the domain in an arbitrary orderboolean isFixed()
boolean contains(int v)
v
- the value whose presence in the domain is to be testedvoid remove(int v)
v
- the value to removeInconsistencyException
- is thrown if the domain becomes emptyvoid fix(int v)
v
- the value to fix.InconsistencyException
- is thrown if the value is not in the domainvoid removeBelow(int v)
v
- the value such that all the values less than v are removedInconsistencyException
- is thrown if the domain becomes emptyvoid removeAbove(int v)
v
- the value such that all the values larger than v are removedInconsistencyException
- is thrown if the domain becomes empty