public final class OffsetView extends IntView
ArExpression.Operator| Modifier and Type | Field and Description |
|---|---|
int |
cste
A constant value
|
_riterator, _viterator, delta, varmIdx, model, monitors, MSG_BOUND, MSG_EMPTY, MSG_INST, MSG_LOW, MSG_REMOVE, MSG_UNKNOWN, MSG_UPP, name, pindices, propagatorsMAX_INT_BOUND, MIN_INT_BOUNDBOOL, CSTE, INT, KIND, REAL, SET, TYPE, VAR, VIEWNO_CHILD| Constructor and Description |
|---|
OffsetView(IntVar var,
int cste)
A view based on var such that var + cste
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(int value)
Checks if a value
v belongs to the domain of this |
protected boolean |
doInstantiateVar(int value)
Action to execute on
IntView.var when this view requires to instantiate it |
protected boolean |
doRemoveIntervalFromVar(int from,
int to)
Action to execute on
IntView.var when this view requires to remove an interval from it |
protected boolean |
doRemoveValueFromVar(int value)
Action to execute on
IntView.var when this view requires to remove a value from it |
protected boolean |
doUpdateLowerBoundOfVar(int value)
Action to execute on
IntView.var when this view requires to update its lower bound |
protected boolean |
doUpdateUpperBoundOfVar(int value)
Action to execute on
IntView.var when this view requires to update its upper bound |
int |
getLB()
Retrieves the lower bound of the variable
|
DisposableRangeIterator |
getRangeIterator(boolean bottomUp)
Retrieves an iterator over ranges (or intervals) of
this. |
int |
getUB()
Retrieves the upper bound of the variable
|
int |
getValue()
Retrieves the current value of the variable if instantiated, otherwier the lower bound.
|
DisposableValueIterator |
getValueIterator(boolean bottomUp)
Retrieves an iterator over values of
this. |
boolean |
isInstantiatedTo(int value)
Checks wether
this is instantiated to val |
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. |
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. |
int |
reverseValue(int value) |
String |
toString() |
int |
transformValue(int value) |
compareTo, createDelta, getDelta, getDomainSize, getRange, getTypeAndKind, getVariable, hasEnumeratedDomain, instantiateTo, isInstantiated, iterator, notifyMonitors, notifyPropagators, removeAllValuesBut, removeInterval, removeValue, removeValues, transformEvent, updateBounds, updateLowerBound, updateUpperBound, why_schedIter, addMonitor, contradiction, getDindex, getId, getIndexInPropagator, getModel, getName, getNbProps, getPIndices, getPropagator, getPropagators, getViews, isAConstant, isBool, link, notifyViews, removeMonitor, setPIndice, subscribeView, unlinkclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitintVar, isBool, isExpressionLeaf_schedIter, addMonitor, contradiction, getDindex, getEnvironment, getIndexInPropagator, getModel, getName, getNbProps, getPIndices, getPropagator, getPropagators, getViews, isAConstant, link, notifyViews, removeMonitor, setPIndice, subscribeView, unlinkforEach, spliteratorabs, add, add, add, dist, dist, div, div, eq, eq, eq, extractVar, ge, ge, getExpressionChild, getModel, gt, gt, ieval, le, le, lt, lt, max, max, max, min, min, min, mod, mod, mul, mul, mul, ne, ne, neg, pow, pow, sqr, sub, subpublic OffsetView(IntVar var, int cste)
var - an integer variablecste - an intpublic IIntDeltaMonitor monitorDelta(ICause propagator)
IntVarthis.propagator - the cause that requires to monitor deltaprotected boolean doInstantiateVar(int value)
throws ContradictionException
IntViewIntView.var when this view requires to instantiate itdoInstantiateVar in class IntViewvalue - value before modification of the viewIntView.var has been modifiedContradictionException - if modification failsprotected boolean doUpdateLowerBoundOfVar(int value)
throws ContradictionException
IntViewIntView.var when this view requires to update its lower bounddoUpdateLowerBoundOfVar in class IntViewvalue - value before modification of the viewIntView.var has been modifiedContradictionException - if modification failsprotected boolean doUpdateUpperBoundOfVar(int value)
throws ContradictionException
IntViewIntView.var when this view requires to update its upper bounddoUpdateUpperBoundOfVar in class IntViewvalue - value before modification of the viewIntView.var has been modifiedContradictionException - if modification failsprotected boolean doRemoveValueFromVar(int value)
throws ContradictionException
IntViewIntView.var when this view requires to remove a value from itdoRemoveValueFromVar in class IntViewvalue - value before modification of the viewIntView.var has been modifiedContradictionException - if modification failsprotected boolean doRemoveIntervalFromVar(int from,
int to)
throws ContradictionException
IntViewIntView.var when this view requires to remove an interval from itdoRemoveIntervalFromVar in class IntViewfrom - first value of the interval before modification of the viewto - last value of the interval before modification of the viewIntView.var has been modifiedContradictionException - if modification failspublic boolean contains(int value)
IntVarv belongs to the domain of thisvalue - inttrue if the value belongs to the domain of this, false otherwise.public boolean isInstantiatedTo(int value)
IntVarthis is instantiated to valvalue - 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
}v - the value to start checking (exclusive)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.v - 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
}v - 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.v - the value to start checking (exclusive)public String toString()
toString in class AbstractVariablepublic DisposableValueIterator getValueIterator(boolean bottomUp)
IntVarthis.
The values can be iterated in a bottom-up way or top-down way.
To bottom-up iterate over the values in a IntVar,
use the following loop:
DisposableValueIterator vit = var.getValueIterator(true);
while(vit.hasNext()){
int v = vit.next();
// operate on value v here
}
vit.dispose();
To top-down iterate over the values in a IntVar,
use the following loop:
DisposableValueIterator vit = var.getValueIterator(false);
while(vit.hasPrevious()){
int v = vit.previous();
// operate on value v here
}
vit.dispose();
Using both previous and next can lead to unexpected behaviour.getValueIterator in interface IntVargetValueIterator in class IntViewbottomUp - way to iterate over values. true means from lower bound to upper bound,
false means from upper bound to lower bound.this.public DisposableRangeIterator getRangeIterator(boolean bottomUp)
IntVarthis.
The ranges can be iterated in a bottom-up way or top-down way.
To bottom-up iterate over the values in a IntVar,
use the following loop:
DisposableRangeIterator rit = var.getRangeIterator(true);
while (rit.hasNext()) {
int from = rit.min();
int to = rit.max();
// operate on range [from,to] here
rit.next();
}
rit.dispose();
To top-down iterate over the values in a IntVar,
use the following loop:
DisposableRangeIterator rit = var.getRangeIterator(false);
while (rit.hasPrevious()) {
int from = rit.min();
int to = rit.max();
// operate on range [from,to] here
rit.previous();
}
rit.dispose();
Using both previous and next can lead to unexpected behaviour.getRangeIterator in interface IntVargetRangeIterator in class IntViewbottomUp - way to iterate over ranges. true means from lower bound to upper bound,
false means from upper bound to lower bound.this.public int transformValue(int value)
value - original valuepublic int reverseValue(int value)
value - original valuepublic void justifyEvent(IntVar var, ICause cause, IntEventType mask, int one, int two, int three)
IViewvar - modified variablecause - cause of the modificationmask - type of modificationone - an inttwo - an intthree - an intCopyright © 2017. All rights reserved.