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, propagators
BOOL, CSTE, INT, KIND, REAL, SET, TYPE, VAR, VIEW
NO_CHILD
Modifier and Type | Method and Description |
---|---|
void |
createDelta()
Create a delta, if necessary, in order to observe removed values of a this.
|
protected EvtScheduler |
createScheduler() |
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 . |
addMonitor, asBoolVar, asIntVar, asRealVar, asSetVar, clearEvents, compareTo, contradiction, getCause, getDindex, getEvtScheduler, getId, getIndexInPropagator, getMask, getModel, getName, getNbProps, getPIndices, getPropagator, getPropagators, getViews, isAConstant, isBool, link, notifyPropagators, notifyViews, removeMonitor, setPIndice, storeEvents, subscribeView, swapOnActivate, swapOnPassivate, unlink
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addMonitor, asBoolVar, asIntVar, asRealVar, asSetVar, clearEvents, contradiction, getCause, getDindex, getEnvironment, getEvtScheduler, getIndexInPropagator, getMask, getModel, getName, getNbProps, getPIndices, getPropagator, getPropagators, getViews, isAConstant, link, notifyPropagators, notifyViews, removeMonitor, setPIndice, storeEvents, subscribeView, swapOnActivate, swapOnPassivate, unlink
compareTo
abs, 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, tanh
protected final IntVar var
protected final double precision
public RealView(IntVar var, double precision)
public IntVar getVariable()
IView
getVariable
in interface IView
public void justifyEvent(IntVar var, ICause cause, IntEventType mask, int one, int two, int three)
IView
justifyEvent
in interface IView
var
- modified variablecause
- cause of the modificationmask
- type of modificationone
- an inttwo
- an intthree
- an intprotected EvtScheduler createScheduler()
createScheduler
in class AbstractVariable
public String toString()
toString
in class AbstractVariable
public double getLB()
RealVar
public double getUB()
RealVar
public boolean updateLowerBound(double value, ICause cause) throws ContradictionException
RealVar
this
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 true
updateLowerBound
in interface RealVar
value
- new lower bound (included)cause
- updating releaserContradictionException
- if the domain become empty due to this actionpublic boolean updateUpperBound(double value, ICause cause) throws ContradictionException
RealVar
this
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 true
updateUpperBound
in interface RealVar
value
- 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
RealVar
this
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,true
updateBounds
in interface RealVar
lowerbound
- 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 RealVar
public boolean isInstantiated()
Variable
this
is instantiated (see implemtations to know what instantiation means).isInstantiated
in interface Variable
true
if this
is instantiatedpublic NoDelta getDelta()
Variable
public void createDelta()
Variable
createDelta
in interface Variable
public void notifyMonitors(IEventType event) throws ContradictionException
Variable
notifyMonitors
in interface Variable
event
- the event which occurred on the variableContradictionException
- if the monitor detects contradiction.public void notify(IEventType event) throws ContradictionException
IView
notify
in interface IView
event
- the event received by the observed variableContradictionException
- if a failure occurspublic IEventType transformEvent(IntEventType evt)
public int getTypeAndKind()
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;
getTypeAndKind
in interface Variable
Copyright © 2018. All rights reserved.