Package minicp.engine.core
Interface IntVar
- All Known Subinterfaces:
BoolVar
- All Known Implementing Classes:
BoolVarImpl,BoolVarIsEqual,IntVarImpl,IntVarViewMul,IntVarViewOffset,IntVarViewOpposite
public interface IntVar
-
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(int v) Returns true if the domain contains the specified value.intfillArray(int[] dest) Copies the values of the domain into an array.voidfix(int v) Fix the specified valueReturns the solver in which this variable was created.booleanisFixed()Returns true if the domain of the variable has a single value.intmax()Returns the maximum of the domain of the variableintmin()Returns the minimum of the domain of the variablevoidAsks thatConstraint.propagate()is called whenever the bound (maximum or minimum values) of the domain of this variable is changes.voidAsks thatConstraint.propagate()is called whenever the domain of this variable changes.voidAsks thatConstraint.propagate()is called whenever the domain of this variable is reduced to a singleton.voidremove(int v) Removes the specified value.voidremoveAbove(int v) Remove all the values above a given valuevoidremoveBelow(int v) Remove all the values less than a given valueintsize()Returns the size of the domain of the variablevoidAsks that the closure is called whenever the max or min setValue of the domain of this variable changesvoidAsks that the closure is called whenever the domain change of this variable changesvoidAsks that the closure is called whenever the domain of this variable is reduced to a single setValue
-
Method Details
-
getSolver
Solver getSolver()Returns the solver in which this variable was created.- Returns:
- the solver in which this variable was created
-
whenFixed
Asks that the closure is called whenever the domain of this variable is reduced to a single setValue- Parameters:
f- the closure
-
whenBoundChange
Asks that the closure is called whenever the max or min setValue of the domain of this variable changes- Parameters:
f- the closure
-
whenDomainChange
Asks that the closure is called whenever the domain change of this variable changes- Parameters:
f- the closure
-
propagateOnDomainChange
Asks thatConstraint.propagate()is called whenever the domain of this variable changes. We say that a change event occurs.- Parameters:
c- the constraint for which theConstraint.propagate()method should be called on change events of this variable.
-
propagateOnFix
Asks thatConstraint.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.- Parameters:
c- the constraint for which theConstraint.propagate()method should be called on fix events of this variable.
-
propagateOnBoundChange
Asks thatConstraint.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.- Parameters:
c- the constraint for which theConstraint.propagate()method should be called on bound change events of this variable.
-
min
int min()Returns the minimum of the domain of the variable- Returns:
- the minimum of the domain of the variable
-
max
int max()Returns the maximum of the domain of the variable- Returns:
- the maximum of the domain of the variable
-
size
int size()Returns the size of the domain of the variable- Returns:
- the size of the domain of the variable
-
fillArray
int fillArray(int[] dest) Copies the values of the domain into an array.- Parameters:
dest- an array large enoughdest.length >= size()- Returns:
- the size of the domain and
dest[0,...,size-1]contains the values in the domain in an arbitrary order
-
isFixed
boolean isFixed()Returns true if the domain of the variable has a single value.- Returns:
- true if the domain of the variable is a singleton.
-
contains
boolean contains(int v) Returns true if the domain contains the specified value.- Parameters:
v- the value whose presence in the domain is to be tested- Returns:
- true if the domain contains the specified value
-
remove
void remove(int v) Removes the specified value.- Parameters:
v- the value to remove- Throws:
InconsistencyException- is thrown if the domain becomes empty
-
fix
void fix(int v) Fix the specified value- Parameters:
v- the value to fix.- Throws:
InconsistencyException- is thrown if the value is not in the domain
-
removeBelow
void removeBelow(int v) Remove all the values less than a given value- Parameters:
v- the value such that all the values less than v are removed- Throws:
InconsistencyException- is thrown if the domain becomes empty
-
removeAbove
void removeAbove(int v) Remove all the values above a given value- Parameters:
v- the value such that all the values larger than v are removed- Throws:
InconsistencyException- is thrown if the domain becomes empty
-