public abstract class AbstractVariable extends Object implements Variable
Modifier and Type | Field and Description |
---|---|
protected boolean |
_plugexpl |
protected int |
mIdx |
protected int |
modificationEvents |
protected IVariableMonitor[] |
monitors |
static String |
MSG_BOUND |
static String |
MSG_EMPTY |
static String |
MSG_INST |
static String |
MSG_LOW |
static String |
MSG_REMOVE |
static String |
MSG_UNKNOWN |
static String |
MSG_UPP |
protected String |
name |
protected Solver |
solver |
Modifier | Constructor and Description |
---|---|
protected |
AbstractVariable(String name,
Solver solver) |
Modifier and Type | Method and Description |
---|---|
void |
addMonitor(IVariableMonitor monitor)
Build and add a monitor to the monitor list of
this . |
int |
compareTo(Variable o) |
int |
getId() |
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
|
IView[] |
getViews()
Get the views observing this variables
|
boolean |
isBool() |
int |
link(Propagator propagator,
int idxInProp)
Link the propagator to this
|
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) |
String |
toString() |
void |
unlink(Propagator propagator)
Remove a propagator from the list of propagator of
this . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
contradiction, createDelta, duplicate, duplicate, getDelta, getTypeAndKind, isInstantiated, notifyMonitors
public static final String MSG_REMOVE
public static final String MSG_EMPTY
public static final String MSG_INST
public static final String MSG_UNKNOWN
public static final String MSG_UPP
public static final String MSG_LOW
public static final String MSG_BOUND
protected final Solver solver
protected final String name
protected IVariableMonitor[] monitors
protected int mIdx
protected int modificationEvents
protected final boolean _plugexpl
public int link(Propagator propagator, int idxInProp)
Variable
public void recordMask(int mask)
Variable
recordMask
in interface Variable
mask
- event maskpublic void unlink(Propagator propagator)
Variable
this
.
SHOULD BE CONTAINED IN THIS.public Propagator[] getPropagators()
Variable
getPropagators
in interface Variable
public Propagator getPropagator(int idx)
Variable
getPropagator
in interface Variable
idx
- position of the propagatorpublic int getNbProps()
Variable
getNbProps
in interface Variable
public int[] getPIndices()
getPIndices
in interface Variable
public int getIndexInPropagator(int pidx)
Variable
getIndexInPropagator
in interface Variable
pidx
- index of the propagator within the list of propagators of thispublic String getName()
Variable
this
public void notifyPropagators(IEventType event, ICause cause) throws ContradictionException
Variable
this
has changed, then notify all of its observers.notifyPropagators
in interface Variable
event
- event on this objectcause
- object which leads to the modification of this objectContradictionException
- if a contradiction occurs during notificationpublic void notifyViews(IEventType event, ICause cause) throws ContradictionException
Variable
notifyViews
in interface Variable
event
- the event which occurred on the variableContradictionException
public void addMonitor(IVariableMonitor monitor)
Variable
this
.
The monitor is inactive at the creation and must be activated (by the engine propagation).addMonitor
in interface Variable
monitor
- a variable monitorpublic void removeMonitor(IVariableMonitor monitor)
removeMonitor
in interface Variable
public void subscribeView(IView view)
subscribeView
in interface Variable
public Solver getSolver()
Variable
public IView[] getViews()
Variable
public int compareTo(Variable o)
compareTo
in interface Comparable<Variable>
public boolean isBool()
Copyright © 2015. All rights reserved.