Class FixedBoolVarImpl
- java.lang.Object
-
- org.chocosolver.solver.variables.impl.AbstractVariable
-
- org.chocosolver.solver.variables.impl.FixedIntVarImpl
-
- org.chocosolver.solver.variables.impl.FixedBoolVarImpl
-
- All Implemented Interfaces:
Cloneable
,Comparable<Variable>
,Iterable<Integer>
,ILogical
,ArExpression
,ReExpression
,ICause
,Identity
,BoolVar
,IntVar
,Variable
public class FixedBoolVarImpl extends FixedIntVarImpl implements BoolVar
A constant view specific to boolean variable Based on "Views and Iterators for Generic Constraint Implementations", C. Schulte and G. Tack- Since:
- 04/02/11
- Author:
- Charles Prud'homme
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.chocosolver.solver.expression.discrete.arithmetic.ArExpression
ArExpression.Operator
-
Nested classes/interfaces inherited from interface org.chocosolver.solver.expression.discrete.relational.ReExpression
ReExpression.Operator
-
-
Field Summary
-
Fields inherited from class org.chocosolver.solver.variables.impl.FixedIntVarImpl
constante
-
Fields inherited from class org.chocosolver.solver.variables.impl.AbstractVariable
mIdx, model, monitors, MSG_EMPTY, MSG_INST, name, propagators
-
Fields inherited from interface org.chocosolver.solver.expression.discrete.arithmetic.ArExpression
NO_CHILD
-
Fields inherited from interface org.chocosolver.solver.variables.IntVar
MAX_INT_BOUND, MIN_INT_BOUND
-
-
Constructor Summary
Constructors Constructor Description FixedBoolVarImpl(String name, int constant, Model model)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
_setNot(BoolVar not)
protected EvtScheduler
createScheduler()
ESat
getBooleanValue()
int
getTypeAndKind()
Return a MASK composed of 2 main information: TYPE and KIND.boolean
hasNot()
boolean
isLit()
Current tree is a literalboolean
isNot()
Current tree is rooted with NOT logical operator This is a one way relationship: in case a = not(b) a.isNot() returns true whereas b.isNot() returns false (unless b = not(c)...)BoolVar
not()
void
setNot(boolean isNot)
States whether or not this variable is the negation of another.boolean
setToFalse(ICause cause)
boolean
setToTrue(ICause cause)
String
toString()
-
Methods inherited from class org.chocosolver.solver.variables.impl.FixedIntVarImpl
addMonitor, contains, createDelta, getDelta, getDomainSize, getLB, getRange, getRangeIterator, getUB, getValue, getValueIterator, hasEnumeratedDomain, instantiateTo, isInstantiated, isInstantiatedTo, iterator, monitorDelta, nextValue, nextValueOut, notifyMonitors, notifyPropagators, notifyViews, previousValue, previousValueOut, removeAllValuesBut, removeInterval, removeValue, removeValues, subscribeView, updateBounds, updateLowerBound, updateUpperBound
-
Methods inherited from class org.chocosolver.solver.variables.impl.AbstractVariable
asBoolVar, asIntVar, asRealVar, asSetVar, clearEvents, compareTo, contradiction, getCause, getDindex, getEvtScheduler, getId, getIndexInPropagator, getMask, getModel, getName, getNbProps, getNbViews, getPIndices, getPropagator, getPropagators, getView, isAConstant, isBool, link, removeMonitor, setPIndice, storeEvents, swapOnActivate, swapOnPassivate, unlink
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.chocosolver.solver.expression.discrete.arithmetic.ArExpression
abs, add, add, add, dist, dist, div, div, eq, eq, eq, ge, ge, getExpressionChild, gt, gt, le, le, lt, lt, max, max, max, min, min, min, mod, mod, mul, mul, mul, ne, ne, neg, pow, pow, sqr, sub, sub
-
Methods inherited from interface org.chocosolver.solver.variables.BoolVar
boolVar, extractVar, intVar
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface org.chocosolver.solver.variables.IntVar
contains, forEachIntVar, getDomainSize, getLB, getNoChild, getRange, getRangeIterator, getUB, getValue, getValueIterator, hasEnumeratedDomain, instantiateTo, isBool, isExpressionLeaf, isInstantiatedTo, monitorDelta, nextValue, nextValueOut, previousValue, previousValueOut, removeAllValuesBut, removeInterval, removeValue, removeValues, transformEvent, updateBounds, updateLowerBound, updateUpperBound
-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface org.chocosolver.solver.expression.discrete.relational.ReExpression
and, beval, decompose, extension, getModel, ieval, iff, ift, ift, ift, ift, imp, or, post, xor
-
Methods inherited from interface org.chocosolver.solver.variables.Variable
addMonitor, asBoolVar, asIntVar, asRealVar, asSetVar, clearEvents, contradiction, createDelta, getCause, getDelta, getDindex, getEnvironment, getEvtScheduler, getIndexInPropagator, getMask, getModel, getName, getNbProps, getNbViews, getPIndices, getPropagator, getPropagators, getView, isAConstant, isInstantiated, link, notifyMonitors, notifyPropagators, notifyViews, removeMonitor, setPIndice, storeEvents, subscribeView, swapOnActivate, swapOnPassivate, unlink
-
-
-
-
Method Detail
-
getTypeAndKind
public int getTypeAndKind()
Description copied from interface:Variable
Return a MASK composed of 2 main information: TYPE and KIND.
TYPE is defined in the 3 first bits : VAR ( 1 << 0), CSTE (1 << 1) or VIEW (1 << 2)
KIND is defined on the other bits : INT (1 << 3), BOOL (INT + 1 << 4), GRAPH (1 << 5) or META (1 << 6) To get the TYPE of a variable:int type = var.getTypeAndKind() & Variable.TYPE;
To get the KIND of a variable:int kind = var.getTypeAndKind() & Variable.KIND;
To check a specific type or kind of a variable:boolean isVar = (var.getTypeAndKind() & Variable.VAR) !=0; boolean isInt = (var.getTypeAndKind() & Variable.INT) !=0;
- Specified by:
getTypeAndKind
in interfaceVariable
- Overrides:
getTypeAndKind
in classFixedIntVarImpl
- Returns:
- an int representing the type and kind of the variable
-
createScheduler
protected EvtScheduler createScheduler()
- Overrides:
createScheduler
in classFixedIntVarImpl
-
getBooleanValue
public ESat getBooleanValue()
- Specified by:
getBooleanValue
in interfaceBoolVar
-
setToTrue
public boolean setToTrue(ICause cause) throws ContradictionException
- Specified by:
setToTrue
in interfaceBoolVar
- Throws:
ContradictionException
-
setToFalse
public boolean setToFalse(ICause cause) throws ContradictionException
- Specified by:
setToFalse
in interfaceBoolVar
- Throws:
ContradictionException
-
not
public BoolVar not()
- Specified by:
not
in interfaceBoolVar
- Specified by:
not
in interfaceReExpression
- Returns:
- return the expression "¬x" where this is "x"
-
isLit
public boolean isLit()
Description copied from interface:ILogical
Current tree is a literal
-
isNot
public boolean isNot()
Description copied from interface:ILogical
Current tree is rooted with NOT logical operator This is a one way relationship: in case a = not(b) a.isNot() returns true whereas b.isNot() returns false (unless b = not(c)...)
-
setNot
public void setNot(boolean isNot)
Description copied from interface:ILogical
States whether or not this variable is the negation of another. This is a one way relationship: in case a = not(b) a.isNot() returns true whereas b.isNot() returns false (unless b = not(c)...)
-
toString
public String toString()
- Overrides:
toString
in classFixedIntVarImpl
-
-