public class RealView extends AbstractVariable implements IView, RealVar
CArExpression.Operator| Modifier and Type | Field and Description |
|---|---|
protected double |
precision |
protected IntVar |
var |
mIdx, model, monitors, MSG_EMPTY, MSG_INST, name, propagatorsBOOL, CSTE, INT, KIND, REAL, SET, TYPE, VAR, VIEWNO_CHILD| Modifier and Type | Method and Description |
|---|---|
void |
createDelta()
Create a delta, if necessary, in order to observe removed values of a this.
|
NoDelta |
getDelta()
Return the delta domain of this
|
double |
getLB()
Retrieves the lower bound of the variable
|
double |
getPrecision() |
int |
getTypeAndKind()
Return a MASK composed of 2 main information: TYPE and KIND.
|
double |
getUB()
Retrieves the upper bound of the variable
|
IntVar |
getVariable()
Return the basis variable
|
boolean |
isInstantiated()
Indicates whether
this is instantiated (see implemtations to know what instantiation means). |
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.
|
void |
notify(IEventType event)
To notify a view that the variable is observed has been modified.
|
void |
notifyMonitors(IEventType event)
Notify monitors of observed variable modifications
|
String |
toString() |
IEventType |
transformEvent(IntEventType evt) |
boolean |
updateBounds(double lowerbound,
double upperbound,
ICause cause)
Updates the bounds of the domain of
this to value. |
boolean |
updateLowerBound(double value,
ICause cause)
Updates the lower bound of the domain of
this to value. |
boolean |
updateUpperBound(double value,
ICause cause)
Updates the upper bound of the domain of
this to value. |
_schedIter, addMonitor, asBoolVar, asIntVar, asRealVar, asSetVar, clearEvents, compareTo, 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, wait_schedIter, addMonitor, asBoolVar, asIntVar, asRealVar, asSetVar, clearEvents, contradiction, getCause, getDindex, getEnvironment, getIndexInPropagator, getMask, getModel, getName, getNbProps, getPIndices, getPropagator, getPropagators, getViews, isAConstant, link, notifyPropagators, notifyViews, removeMonitor, setPIndice, storeEvents, subscribeView, swapOnActivate, swapOnPassivate, unlinkcompareToabs, acos, acosh, add, add, asin, asinh, atan, atan2, atan2, atanh, cos, cosh, div, div, eq, eq, exp, ge, ge, getModel, gt, gt, le, le, ln, lt, lt, max, max, min, min, mul, mul, neg, pow, pow, sin, sinh, sqrt, sub, sub, tan, tanhprotected final IntVar var
protected final double precision
public RealView(IntVar var, double precision)
public IntVar getVariable()
IViewgetVariable in interface IViewpublic 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 intpublic String toString()
toString in class AbstractVariablepublic double getLB()
RealVarpublic double getUB()
RealVarpublic boolean updateLowerBound(double value,
ICause cause)
throws ContradictionException
RealVarthis 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 RealVarvalue - new lower bound (included)cause - updating releaserContradictionException - if the domain become empty due to this actionpublic boolean updateUpperBound(double value,
ICause cause)
throws ContradictionException
RealVarthis 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 RealVarvalue - new upper bound (included)cause - update releaserContradictionException - if the domain become empty due to this actionpublic boolean updateBounds(double lowerbound,
double upperbound,
ICause cause)
throws ContradictionException
RealVarthis to value.
The instruction comes from propagator.
lowerbound,upperbound] includes the domain of this, nothing is done and the return value is false,ContradictionException is thrown,trueupdateBounds in interface RealVarlowerbound - new lower bound (included)upperbound - new upper bound (included)cause - update releaserContradictionException - if the domain become empty due to this actionpublic double getPrecision()
getPrecision in interface RealVarpublic boolean isInstantiated()
Variablethis is instantiated (see implemtations to know what instantiation means).isInstantiated in interface Variabletrue if this is instantiatedpublic NoDelta getDelta()
Variablepublic void createDelta()
VariablecreateDelta in interface Variablepublic void notifyMonitors(IEventType event) throws ContradictionException
VariablenotifyMonitors in interface Variableevent - the event which occurred on the variableContradictionException - if the monitor detects contradiction.public void notify(IEventType event) throws ContradictionException
IViewnotify in interface IViewevent - the event received by the observed variableContradictionException - if a failure occurspublic IEventType transformEvent(IntEventType evt)
public 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 VariableCopyright © 2018. All rights reserved.