public class RealVarImpl extends AbstractVariable implements RealVar
CArExpression.Operator
mIdx, model, monitors, MSG_EMPTY, MSG_INST, name, propagators
BOOL, CSTE, INT, KIND, REAL, SET, TYPE, VAR, VIEW
NO_CHILD
Constructor and Description |
---|
RealVarImpl(String name,
double lb,
double ub,
double precision,
Model model) |
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
|
boolean |
isInstantiated()
Indicates whether
this is instantiated (see implemtations to know what instantiation means). |
String |
toString() |
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, getNbViews, getPIndices, getPropagator, getPropagators, getView, isAConstant, isBool, link, notifyMonitors, 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, getNbViews, getPIndices, getPropagator, getPropagators, getView, isAConstant, link, notifyMonitors, 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
public double getPrecision()
getPrecision
in interface RealVar
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 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 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
protected EvtScheduler createScheduler()
createScheduler
in class AbstractVariable
public String toString()
toString
in class AbstractVariable
Copyright © 2018. All rights reserved.