- All Superinterfaces:
BoolExpression,BoolVar,ConcreteBoolVar,ConcreteIntVar,ConcreteVar,CPIntVar,CPVar,Expression,IntExpression,IntVar,Serializable,Var
- All Known Implementing Classes:
CPBoolVarImpl,CPBoolVarIsEqual
Boolean variable, that can be used as a 0-1 IntVar.
0 corresponds to false, and 1 corresponds to true
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleancontains(int v) Returns true if the domain contains the specified value.default booleandefault intfillArray(int[] array) Copies the values of the domain into an array.voidfix(boolean b) Fixes the variablebooleanisFalse()Tests if the variable is fixed to falsebooleanisTrue()Tests if the variable is fixed to truedefault intmax()Returns the maximum of the domain of the variabledefault intmin()Returns the minimum of the domain of the variabledefault intsize()Returns the size of the domain of the variableMethods inherited from interface org.maxicp.modeling.algebra.bool.BoolExpression
reifyMethods inherited from interface org.maxicp.cp.engine.core.CPIntVar
abs, after, before, delta, evaluate, fillDeltaArray, fix, getSolver, isFixed, minus, minus, plus, plus, propagateOnBoundChange, propagateOnDomainChange, propagateOnFix, remove, removeAbove, removeBelow, whenBoundChange, whenDomainChange, whenDomainChange, whenFixedMethods inherited from interface org.maxicp.modeling.algebra.Expression
getModelProxy, subexpressionsMethods inherited from interface org.maxicp.modeling.algebra.integer.IntExpression
showMethods inherited from interface org.maxicp.modeling.IntVar
computeSubexpressions, isFixed, mapSubexpressionsMethods inherited from interface org.maxicp.modeling.Var
getModelProxy
-
Method Details
-
isTrue
boolean isTrue()Tests if the variable is fixed to true- Returns:
- true if the variable is fixed to true (value 1)
-
isFalse
boolean isFalse()Tests if the variable is fixed to false- Returns:
- true if the variable is fixed to false (value 0)
-
fix
void fix(boolean b) Fixes the variable- Parameters:
b- the value to assign to this boolean variable- Throws:
InconsistencyException- is thrown if the value is not in the domain
-
min
default int min()Description copied from interface:CPIntVarReturns the minimum of the domain of the variable- Specified by:
minin interfaceCPIntVar- Specified by:
minin interfaceIntExpression- Returns:
- the minimum of the domain of the variable
-
max
default int max()Description copied from interface:CPIntVarReturns the maximum of the domain of the variable- Specified by:
maxin interfaceCPIntVar- Specified by:
maxin interfaceIntExpression- Returns:
- the maximum of the domain of the variable
-
fillArray
default int fillArray(int[] array) Description copied from interface:CPIntVarCopies the values of the domain into an array.- Specified by:
fillArrayin interfaceCPIntVar- Specified by:
fillArrayin interfaceIntExpression- Parameters:
array- 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
-
size
default int size()Description copied from interface:CPIntVarReturns the size of the domain of the variable- Specified by:
sizein interfaceCPIntVar- Specified by:
sizein interfaceIntExpression- Returns:
- the size of the domain of the variable
-
contains
default boolean contains(int v) Description copied from interface:CPIntVarReturns true if the domain contains the specified value.- Specified by:
containsin interfaceCPIntVar- Specified by:
containsin interfaceIntExpression- Parameters:
v- the value whose presence in the domain is to be tested- Returns:
- true if the domain contains the specified value
-
evaluateBool
- Specified by:
evaluateBoolin interfaceBoolExpression- Throws:
VariableNotFixedException
-