java.lang.Object
org.maxicp.cp.engine.core.CPBoolVarImpl
- All Implemented Interfaces:
Serializable,CPBoolVar,CPIntVar,CPVar,BoolExpression,Expression,IntExpression,BoolVar,ConcreteBoolVar,ConcreteIntVar,ConcreteVar,IntVar,Var
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCPBoolVarImpl(CPIntVar binaryVar) Create a boolean variable view from the binary variable -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(int v) Returns true if the domain contains the specified value.Returns a delta object allowing to retrieve the changes in the domain of the variable (removed values) since the previous call to theConstraint.propagateof the constraint.intfillArray(int[] dest) Copies the values of the domain into an array.intfillDeltaArray(int oldMin, int oldMax, int oldSize, int[] dest) Copies the values of the domain that have been removed (delta set) wrt to a previous state of the domain described by oldMin, oldMax and oldSize.voidfix(boolean b) Fixes the variablevoidfix(int v) Fixes the specified value.Returns the ModelDispatcher linked to this ExpressionReturns the solver in which this variable was created.booleanisFalse()Tests if the variable is fixed to falsebooleanisFixed()Returns true if the domain of the variable has a single value.booleanisTrue()Tests if the variable is fixed to trueintmax()Returns the maximum of the domain of the variableintmin()Returns the minimum of the domain of the variablevoidAsks thatCPConstraint.propagate()is called whenever the bound (maximum or minimum values) of the domain of this variable is changes.voidAsks thatCPConstraint.propagate()is called whenever the domain of this variable changes.voidAsks thatCPConstraint.propagate()is called whenever the domain of this variable is reduced to a singleton.voidremove(int v) Removes the specified value.voidremoveAbove(int v) Removes all the values above a given value.voidremoveBelow(int v) Removes all the values less than a given value.intsize()Returns the size of the domain of the variabletoString()voidAsks 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 consumer is called whenever the domain change of this variable changes.voidAsks that the closure is called whenever the domain of this variable is reduced to a single setValue.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.maxicp.modeling.algebra.bool.BoolExpression
reifyMethods inherited from interface org.maxicp.cp.engine.core.CPBoolVar
evaluateBoolMethods inherited from interface org.maxicp.cp.engine.core.CPIntVar
abs, after, before, evaluate, minus, minus, plus, plusMethods inherited from interface org.maxicp.modeling.algebra.Expression
subexpressionsMethods inherited from interface org.maxicp.modeling.algebra.integer.IntExpression
showMethods inherited from interface org.maxicp.modeling.IntVar
computeSubexpressions, mapSubexpressions
-
Constructor Details
-
CPBoolVarImpl
Create a boolean variable view from the binary variable- Parameters:
binaryVar-
-
CPBoolVarImpl
-
-
Method Details
-
isTrue
public boolean isTrue()Description copied from interface:CPBoolVarTests if the variable is fixed to true -
isFalse
public boolean isFalse()Description copied from interface:CPBoolVarTests if the variable is fixed to false -
fix
public void fix(boolean b) Description copied from interface:CPBoolVarFixes the variable -
getSolver
Description copied from interface:CPIntVarReturns the solver in which this variable was created. -
whenFixed
Description copied from interface:CPIntVarAsks that the closure is called whenever the domain of this variable is reduced to a single setValue. -
whenBoundChange
Description copied from interface:CPIntVarAsks that the closure is called whenever the max or min setValue of the domain of this variable changes- Specified by:
whenBoundChangein interfaceCPIntVar- Parameters:
f- the closure
-
whenDomainChange
Description copied from interface:CPIntVarAsks that the closure is called whenever the domain change of this variable changes- Specified by:
whenDomainChangein interfaceCPIntVar- Parameters:
f- the closure
-
whenDomainChange
Description copied from interface:CPIntVarAsks that the consumer is called whenever the domain change of this variable changes. The consumer is called with a delta object that allows to retrieve the changes in the domain of the variable (removed values) since the previous call.- Specified by:
whenDomainChangein interfaceCPIntVar- Parameters:
f- the consumer with the delta of the domain since last call
-
propagateOnDomainChange
Description copied from interface:CPIntVarAsks thatCPConstraint.propagate()is called whenever the domain of this variable changes. We say that a change event occurs.- Specified by:
propagateOnDomainChangein interfaceCPIntVar- Parameters:
c- the constraint for which theCPConstraint.propagate()method should be called on change events of this variable.
-
propagateOnFix
Description copied from interface:CPIntVarAsks thatCPConstraint.propagate()is called whenever the domain of this variable is reduced to a singleton. In such a state the variable is bind and we say that a bind event occurs.- Specified by:
propagateOnFixin interfaceCPIntVar- Parameters:
c- the constraint for which theCPConstraint.propagate()method should be called on bind events of this variable.
-
propagateOnBoundChange
Description copied from interface:CPIntVarAsks thatCPConstraint.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.- Specified by:
propagateOnBoundChangein interfaceCPIntVar- Parameters:
c- the constraint for which theCPConstraint.propagate()method should be called on bound change events of this variable.
-
min
public int min()Description copied from interface:CPIntVarReturns the minimum of the domain of the variable -
max
public int max()Description copied from interface:CPIntVarReturns the maximum of the domain of the variable -
size
public int size()Description copied from interface:CPIntVarReturns the size of the domain of the variable -
fillArray
public int fillArray(int[] dest) Description copied from interface:CPIntVarCopies the values of the domain into an array.- Specified by:
fillArrayin interfaceCPBoolVar- Specified by:
fillArrayin interfaceCPIntVar- Specified by:
fillArrayin interfaceIntExpression- 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
public boolean isFixed()Description copied from interface:CPIntVarReturns true if the domain of the variable has a single value. -
contains
public boolean contains(int v) Description copied from interface:CPIntVarReturns true if the domain contains the specified value. -
remove
public void remove(int v) Description copied from interface:CPIntVarRemoves the specified value. -
fix
public void fix(int v) Description copied from interface:CPIntVarFixes the specified value. -
removeBelow
public void removeBelow(int v) Description copied from interface:CPIntVarRemoves all the values less than a given value.- Specified by:
removeBelowin interfaceCPIntVar- Parameters:
v- the value such that all the values less than v are removed
-
removeAbove
public void removeAbove(int v) Description copied from interface:CPIntVarRemoves all the values above a given value.- Specified by:
removeAbovein interfaceCPIntVar- Parameters:
v- the value such that all the values larger than v are removed
-
fillDeltaArray
public int fillDeltaArray(int oldMin, int oldMax, int oldSize, int[] dest) Description copied from interface:CPIntVarCopies the values of the domain that have been removed (delta set) wrt to a previous state of the domain described by oldMin, oldMax and oldSize.- Specified by:
fillDeltaArrayin interfaceCPIntVar- Parameters:
dest- an array large enoughdest.length >= oldSize-size()- Returns:
- the size of delta set stored in prefix of dest
-
delta
Description copied from interface:CPIntVarReturns a delta object allowing to retrieve the changes in the domain of the variable (removed values) since the previous call to theConstraint.propagateof the constraint. This can be useful to implement some constraint with incremental reasoning. -
toString
-
getModelProxy
Description copied from interface:ExpressionReturns the ModelDispatcher linked to this Expression- Specified by:
getModelProxyin interfaceExpression- Specified by:
getModelProxyin interfaceVar
-