public final class BoolNotView extends IntView<BoolVar> implements BoolVar
ReExpression.OperatormIdx, model, monitors, MSG_EMPTY, MSG_INST, name, propagatorsMAX_INT_BOUND, MIN_INT_BOUNDBOOL, CSTE, INT, KIND, REAL, SET, TYPE, VAR, VIEWNO_CHILD| Constructor and Description |
|---|
BoolNotView(BoolVar var)
Create a not view based on var
|
| Modifier and Type | Method and Description |
|---|---|
void |
_setNot(BoolVar not) |
boolean |
contains(int value)
Checks if a value
v belongs to the domain of this |
ESat |
getBooleanValue() |
int |
getLB()
Retrieves the lower bound of the variable
|
int |
getTypeAndKind()
Return a MASK composed of 2 main information: TYPE and KIND.
|
int |
getUB()
Retrieves the upper bound of the variable
|
int |
getValue()
Retrieves the current value of the variable if instantiated, otherwier the lower bound.
|
boolean |
hasNot() |
boolean |
instantiateTo(int value,
ICause cause)
Instantiates the domain of
this to value. |
boolean |
isInstantiatedTo(int value)
Checks wether
this is instantiated to val |
boolean |
isLit()
Current tree is a literal
|
boolean |
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)...)
|
void |
justifyEvent(IntVar var,
ICause cause,
IntEventType mask,
int one,
int two,
int three)
This methods is related to explanations, it binds an event occurring on the observed
variable to the view.
|
IIntDeltaMonitor |
monitorDelta(ICause propagator)
Allow to monitor removed values of
this. |
int |
nextValue(int v)
Returns the first value just after v in
this which is in the domain. |
int |
nextValueOut(int v)
Returns the first value just after v in
this which is out of the domain. |
BoolVar |
not() |
int |
previousValue(int v)
Returns the previous value just before v in
this. |
int |
previousValueOut(int v)
Returns the first value just before v in
this which is out of the domain. |
boolean |
removeAllValuesBut(IntIterableSet values,
ICause cause)
Removes all values from the domain of
this except those in values. |
boolean |
removeInterval(int from,
int to,
ICause cause)
Removes values between [
from, to] from the domain of this. |
boolean |
removeValue(int value,
ICause cause)
Removes
valuefrom the domain of this. |
boolean |
removeValues(IntIterableSet values,
ICause cause)
Removes the value in
valuesfrom the domain of this. |
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() |
int |
transformValue(int value) |
boolean |
updateBounds(int lb,
int ub,
ICause cause)
Updates the lower bound and the upper bound of the domain of
this to, resp. |
boolean |
updateLowerBound(int value,
ICause cause)
Updates the lower bound of the domain of
this to value. |
boolean |
updateUpperBound(int value,
ICause cause)
Updates the upper bound of the domain of
this to value. |
boolean |
why(RuleStore ruleStore,
IntVar modifiedVar,
IEventType evt,
int value)
Add new rules to the rule store
|
compareTo, createDelta, doInstantiateVar, doRemoveIntervalFromVar, doRemoveValueFromVar, doUpdateLowerBoundOfVar, doUpdateUpperBoundOfVar, getDelta, getDomainSize, getRange, getRangeIterator, getValueIterator, getVariable, hasEnumeratedDomain, isInstantiated, iterator, notify, notifyMonitors, transformEvent_schedIter, addMonitor, asBoolVar, asIntVar, asRealVar, asSetVar, clearEvents, contradiction, getCause, getDindex, getId, getIndexInPropagator, getMask, getModel, getName, getNbProps, getPIndices, getPropagator, getPropagators, getViews, isAConstant, isBool, link, notifyPropagators, notifyViews, removeMonitor, setPIndice, storeEvents, subscribeView, swapOnActivate, swapOnPassivate, unlinkclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitboolVar, extractVar, intVargetDomainSize, getNoChild, getRange, getRangeIterator, getValueIterator, hasEnumeratedDomain, isBool, isExpressionLeaf, reverseValue, transformEvent_schedIter, addMonitor, asBoolVar, asIntVar, asRealVar, asSetVar, clearEvents, contradiction, createDelta, getCause, getDelta, getDindex, getEnvironment, getIndexInPropagator, getMask, getModel, getName, getNbProps, getPIndices, getPropagator, getPropagators, getViews, isAConstant, isInstantiated, link, notifyMonitors, notifyPropagators, notifyViews, removeMonitor, setPIndice, storeEvents, subscribeView, swapOnActivate, swapOnPassivate, unlinkcompareToforEach, iterator, spliteratorpublic BoolNotView(BoolVar var)
var - a boolean variablepublic ESat getBooleanValue()
getBooleanValue in interface BoolVarpublic boolean setToTrue(ICause cause) throws ContradictionException
setToTrue in interface BoolVarContradictionExceptionpublic boolean setToFalse(ICause cause) throws ContradictionException
setToFalse in interface BoolVarContradictionExceptionpublic boolean removeValue(int value,
ICause cause)
throws ContradictionException
IntVarvaluefrom the domain of this. The instruction comes from propagator.
value is out of the domain, nothing is done and the return value is false,value leads to a dead-end (domain wipe-out),
a ContradictionException is thrown,value from the domain can be done safely,
the event type is created (the original event can be promoted) and observers are notified
and the return value is trueremoveValue in interface IntVarremoveValue in class IntView<BoolVar>value - value to remove from the domain (int)cause - removal releaserContradictionException - if the domain become empty due to this actionpublic boolean removeValues(IntIterableSet values, ICause cause) throws ContradictionException
IntVarvaluesfrom the domain of this. The instruction comes from propagator.
false,ContradictionException is thrown,values from the domain can be done safely,
the event type is created (the original event can be promoted) and observers are notified
and the return value is trueremoveValues in interface IntVarremoveValues in class IntView<BoolVar>values - set of ordered values to removecause - removal releaseContradictionException - if the domain become empty due to this actionpublic boolean removeAllValuesBut(IntIterableSet values, ICause cause) throws ContradictionException
IntVarthis except those in values. The instruction comes from propagator.
ContradictionException is thrown,false,values from the domain can be done safely,
the event type is created (the original event can be promoted) and observers are notified
and the return value is trueremoveAllValuesBut in interface IntVarremoveAllValuesBut in class IntView<BoolVar>values - set of ordered values to keep in the domaincause - removal releaseContradictionException - if the domain become empty due to this actionpublic boolean removeInterval(int from,
int to,
ICause cause)
throws ContradictionException
IntVarfrom, to] from the domain of this. The instruction comes from propagator.
false,value leads to a dead-end (domain wipe-out),
a ContradictionException is thrown,value from the domain can be done safely,
the event type is created (the original event can be promoted) and observers are notified
and the return value is trueremoveInterval in interface IntVarremoveInterval in class IntView<BoolVar>from - lower bound of the interval to remove (int)to - upper bound of the interval to remove(int)cause - removal releaserContradictionException - if the domain become empty due to this actionpublic boolean instantiateTo(int value,
ICause cause)
throws ContradictionException
IntVarthis to value. The instruction comes from propagator.
this is already instantiated to value,
nothing is done and the return value is false,this is already instantiated to another value,
then a ContradictionException is thrown,this is restricted to value and the observers are notified
and the return value is true.instantiateTo in interface IntVarinstantiateTo in class IntView<BoolVar>value - instantiation value (int)cause - instantiation releaserContradictionException - if the domain become empty due to this actionpublic boolean updateLowerBound(int value,
ICause cause)
throws ContradictionException
IntVarthis to value.
The instruction comes from propagator.
value is smaller than the lower bound of the domain, nothing is done and the return value is false,value leads to a dead-end (domain wipe-out),
a ContradictionException is thrown,value can be done safely,
the event type is created (the original event can be promoted) and observers are notified
and the return value is trueupdateLowerBound in interface IntVarupdateLowerBound in class IntView<BoolVar>value - new lower bound (included)cause - updating releaserContradictionException - if the domain become empty due to this actionpublic boolean updateUpperBound(int value,
ICause cause)
throws ContradictionException
IntVarthis to value.
The instruction comes from propagator.
value is greater than the upper bound of the domain, nothing is done and the return value is false,value leads to a dead-end (domain wipe-out),
a ContradictionException is thrown,value can be done safely,
the event type is created (the original event can be promoted) and observers are notified
and the return value is trueupdateUpperBound in interface IntVarupdateUpperBound in class IntView<BoolVar>value - new upper bound (included)cause - update releaserContradictionException - if the domain become empty due to this actionpublic boolean updateBounds(int lb,
int ub,
ICause cause)
throws ContradictionException
IntVarthis to, resp. lb and ub.
The instruction comes from propagator.
lb is smaller than the lower bound of the domain
and ub is greater than the upper bound of the domain,
nothing is done and the return value is false,
lb, or updating the upper bound to ub leads to a dead-end (domain wipe-out),
or if lb is strictly greater than ub,
a ContradictionException is thrown,lb and/or the upper bound to ub
can be done safely can be done safely,
the event type is created (the original event can be promoted) and observers are notified
and the return value is trueupdateBounds in interface IntVarupdateBounds in class IntView<BoolVar>lb - new lower bound (included)ub - new upper bound (included)cause - update releaserContradictionException - if the domain become empty due to this actionpublic boolean contains(int value)
IntVarv belongs to the domain of thispublic boolean isInstantiatedTo(int value)
IntVarthis is instantiated to valisInstantiatedTo in interface IntVarvalue - intthis is instantiated to val, false otherwisepublic int getValue()
IntVarpublic int getLB()
IntVarpublic int getUB()
IntVarpublic int nextValue(int v)
IntVarthis which is in the domain.
If no such value exists, returns Integer.MAX_VALUE;
To iterate over the values in a IntVar,
use the following loop:
int ub = iv.getUB();
for (int i = iv.getLB(); i <= ub; i = iv.nextValue(i)) {
// operate on value i here
}public int nextValueOut(int v)
IntVarthis which is out of the domain.
If v is less than or equal to IntVar.getLB()-2, returns v + 1,
if v is greater than or equal to IntVar.getUB(), returns v + 1.nextValueOut in interface IntVarv - the value to start checking (exclusive)public int previousValue(int v)
IntVarthis.
If no such value exists, returns Integer.MIN_VALUE;
To iterate over the values in a IntVar,
use the following loop:
int lb = iv.getLB();
for (int i = iv.getUB(); i >= lb; i = iv.previousValue(i)) {
// operate on value i here
}previousValue in interface IntVarv - the value to start checking (exclusive)public int previousValueOut(int v)
IntVarthis which is out of the domain.
If v is greater than or equal to IntVar.getUB()+2, returns v - 1,
if v is less than or equal to IntVar.getLB(), returns v - 1.previousValueOut in interface IntVarv - the value to start checking (exclusive)public IIntDeltaMonitor monitorDelta(ICause propagator)
IntVarthis.monitorDelta in interface IntVarpropagator - the cause that requires to monitor deltapublic String toString()
toString in class AbstractVariablepublic BoolVar not()
not in interface ReExpressionnot in interface BoolVarpublic boolean isLit()
ILogicalpublic boolean isNot()
ILogicalpublic void setNot(boolean isNot)
ILogicalpublic int getTypeAndKind()
Variableint 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;
getTypeAndKind in interface VariablegetTypeAndKind in class IntView<BoolVar>public boolean why(RuleStore ruleStore, IntVar modifiedVar, IEventType evt, int value)
ICausewhy in interface ICausewhy in interface IntVarwhy in class IntView<BoolVar>ruleStore - the rule storemodifiedVar - the modified variableevt - the undergoing eventvalue - the value (for REMOVE only)public int transformValue(int value)
transformValue in interface IntVarvalue - original valuepublic void justifyEvent(IntVar var, ICause cause, IntEventType mask, int one, int two, int three)
IViewjustifyEvent in interface IViewvar - modified variablecause - cause of the modificationmask - type of modificationone - an inttwo - an intthree - an intCopyright © 2018. All rights reserved.