public interface Variable extends Identity, Serializable, Comparable<Variable>
Modifier and Type | Field and Description |
---|---|
static int |
BOOL |
static int |
CSTE |
static int |
INT |
static int |
KIND |
static int |
REAL |
static int |
SET |
static int |
TYPE |
static int |
VAR |
static int |
VIEW |
Modifier and Type | Method and Description |
---|---|
void |
addMonitor(IVariableMonitor monitor)
Build and add a monitor to the monitor list of
this . |
void |
contradiction(ICause cause,
IEventType event,
String message)
Throws a contradiction exception based on
|
void |
createDelta()
Create a delta, if necessary, in order to observe removed values of a this.
|
<V extends Variable> |
duplicate()
Duplicate
this . |
void |
duplicate(Solver solver,
gnu.trove.map.hash.THashMap<Object,Object> identitymap)
Duplicate
this (which naturally adds it into solver ). |
IDelta |
getDelta()
Return the delta domain of this
|
int |
getIndexInPropagator(int pidx)
Return the position of the variable in the propagator at position pidx
|
String |
getName()
Returns the name of
this |
int |
getNbProps()
Return the number of propagators
|
int[] |
getPIndices() |
Propagator |
getPropagator(int idx)
Return the "idx" th propagator of this
|
Propagator[] |
getPropagators()
Return the array of propagators this
|
Solver |
getSolver()
Return the associated solver
|
int |
getTypeAndKind()
Return a MASK composed of 2 main information: TYPE and KIND.
|
IView[] |
getViews()
Get the views observing this variables
|
boolean |
isInstantiated()
Indicates whether
this is instantiated (see implemtations to know what instantiation means). |
int |
link(Propagator propagator,
int idxInProp)
Link the propagator to this
|
void |
notifyMonitors(IEventType event)
Notify monitors of observed variable modifications
|
void |
notifyPropagators(IEventType event,
ICause cause)
If
this has changed, then notify all of its observers. |
void |
notifyViews(IEventType event,
ICause cause)
Notify views of observed variable modifications
|
void |
recordMask(int mask)
Analysis propagator event reaction on this, and adapt this
|
void |
removeMonitor(IVariableMonitor monitor) |
void |
subscribeView(IView view) |
void |
unlink(Propagator propagator)
Remove a propagator from the list of propagator of
this . |
compareTo
static final int VAR
static final int CSTE
static final int VIEW
static final int TYPE
static final int INT
static final int BOOL
static final int SET
static final int REAL
static final int KIND
boolean isInstantiated()
this
is instantiated (see implemtations to know what instantiation means).true
if this
is instantiatedString getName()
this
this
Propagator[] getPropagators()
Propagator getPropagator(int idx)
idx
- position of the propagatorint getNbProps()
int[] getPIndices()
int getIndexInPropagator(int pidx)
pidx
- index of the propagator within the list of propagators of thisvoid addMonitor(IVariableMonitor monitor)
this
.
The monitor is inactive at the creation and must be activated (by the engine propagation).monitor
- a variable monitorvoid removeMonitor(IVariableMonitor monitor)
void subscribeView(IView view)
IDelta getDelta()
void createDelta()
int link(Propagator propagator, int idxInProp)
propagator
- a newly added propagatoridxInProp
- index of the variable in the propagatorvoid recordMask(int mask)
mask
- event maskvoid unlink(Propagator propagator)
this
.
SHOULD BE CONTAINED IN THIS.propagator
- the propagator to removevoid notifyPropagators(IEventType event, ICause cause) throws ContradictionException
this
has changed, then notify all of its observers.event
- event on this objectcause
- object which leads to the modification of this objectContradictionException
- if a contradiction occurs during notificationvoid notifyViews(IEventType event, ICause cause) throws ContradictionException
event
- the event which occurred on the variableContradictionException
IView[] getViews()
void notifyMonitors(IEventType event) throws ContradictionException
event
- the event which occurred on the variableContradictionException
void contradiction(ICause cause, IEventType event, String message) throws ContradictionException
cause
- ICause causing the exceptionevent
- event causing the contradictionmessage
- the detailed message @throws ContradictionException expected behaviorContradictionException
Solver getSolver()
int getTypeAndKind()
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;
<V extends Variable> V duplicate()
this
.V
- the copythis
Copyright © 2015. All rights reserved.