|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchoco.AbstractEntity
choco.AbstractConstraint
public abstract class AbstractConstraint
An abstract class for all implementations of listeners
| Field Summary | |
|---|---|
protected IStateBool |
active
a field for storing whether the constraint is active or not |
protected ConstraintEvent |
constAwakeEvent
The constraint awake var attached to the constraint. |
protected ConstraintPlugin |
hook
A field for attaching additional data util (useful for PaLM) |
protected int |
priority
The priority of the constraint. |
| Fields inherited from class choco.AbstractEntity |
|---|
problem |
| Constructor Summary | |
|---|---|
AbstractConstraint()
Constraucts a constraint with the priority 0. |
|
AbstractConstraint(int priority)
Constructs a constraint with the specified priority. |
|
| Method Summary | |
|---|---|
void |
addListener(boolean dynamicAddition)
This function connects a constraint with its variables in several ways. |
void |
awake()
Default initial propagation: full constraint re-propagation. |
void |
awakeOnVar(int idx)
Default propagation on variable revision: full constraint re-propagation. |
java.lang.Object |
clone()
returns a copy of the constraint. |
int |
connectVar(AbstractVar v,
int j,
boolean dynamicAddition)
|
void |
constAwake(boolean isInitialPropagation)
Initial propagation of the constraint. |
void |
delete()
Removes a constraint from the network. |
void |
fail()
raise a contradiction during propagation when the constraint can definitely not be satisfied given the current domains |
PropagationEvent |
getEvent()
Returns the constraint awake var attached to the constraint. |
ConstraintPlugin |
getPlugIn()
Returns the constraint plugin. |
int |
getPriority()
Returns the priority. |
AbstractProblem |
getProblem()
Retrieve the problem of the constraint. |
int |
getVarIdxInOpposite(int i)
computes the index of the i-th variable in the counter-opposite of the constraint |
boolean |
isActive()
Checks if the constraint is active (e.g. plays a role in the propagation phase). |
java.lang.Boolean |
isEntailed()
Checks whether the constraint is definitely satisfied, no matter what further restrictions occur to the domain of its variables. |
boolean |
isEquivalentTo(Constraint compareTo)
tests the equivalence (logical equality of the conditions) between two constraints. |
AbstractConstraint |
opposite()
computes the constraint modelling the counter-opposite condition of this |
void |
setActive()
Un-freezing a constraint (this is useful for mimicking dynamic constraint posts...). |
void |
setEntailed()
records that a constraint is now entailed (therefore it is now useless to propagate it again) |
void |
setPassive()
Freezing a constraint (this is useful for backtracking when mimicking dynamic constraint posts...). |
void |
setPlugIn(ConstraintPlugin hook)
Set the ConstraintPlugin of the constraint. |
int |
substituteVar(Var oldvar,
Var newvar)
substitues all occurrences of a variable in a constraint by another variable |
| Methods inherited from class choco.AbstractEntity |
|---|
pretty |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface choco.Propagator |
|---|
assignIndices, isCompletelyInstantiated, isConsistent, propagate |
| Methods inherited from interface choco.Constraint |
|---|
getConstraintIdx, getNbVars, getVar, isSatisfied, setConstraintIndex, setVar |
| Methods inherited from interface choco.Entity |
|---|
pretty |
| Field Detail |
|---|
protected int priority
protected ConstraintEvent constAwakeEvent
protected ConstraintPlugin hook
protected IStateBool active
| Constructor Detail |
|---|
public AbstractConstraint()
public AbstractConstraint(int priority)
priority - The wished priority.| Method Detail |
|---|
public ConstraintPlugin getPlugIn()
getPlugIn in interface Propagatorpublic void setPlugIn(ConstraintPlugin hook)
hook - public PropagationEvent getEvent()
getEvent in interface Propagatorpublic void constAwake(boolean isInitialPropagation)
constAwake in interface Propagatorpublic int getPriority()
getPriority in interface Propagator
public void awakeOnVar(int idx)
throws ContradictionException
awakeOnVar in interface VarEventListenerawakeOnVar in interface PropagatorContradictionException
public void awake()
throws ContradictionException
awake in interface PropagatorContradictionExceptionpublic AbstractProblem getProblem()
getProblem in interface EntitygetProblem in class AbstractEntitypublic void setActive()
setActive in interface VarEventListenerpublic void setPassive()
setPassive in interface VarEventListenerpublic void setEntailed()
public void delete()
delete in interface Propagator
public void fail()
throws ContradictionException
ContradictionExceptionpublic java.lang.Boolean isEntailed()
Propagator
isEntailed in interface Propagatorpublic boolean isActive()
isActive in interface VarEventListenerpublic void addListener(boolean dynamicAddition)
addListener in interface VarEventListenerpublic int getVarIdxInOpposite(int i)
Constraint
getVarIdxInOpposite in interface Constrainti - the index of the variable in the current constraint (this)
public AbstractConstraint opposite()
Constraint
opposite in interface Constraint
public int connectVar(AbstractVar v,
int j,
boolean dynamicAddition)
public boolean isEquivalentTo(Constraint compareTo)
Constraint
isEquivalentTo in interface ConstraintcompareTo - the constraint to be compared to
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
Constraint
clone in interface Constraintclone in class java.lang.Objectjava.lang.CloneNotSupportedException
public int substituteVar(Var oldvar,
Var newvar)
oldvar - the variable to be removednewvar - the variable to be introduced in place of the other
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||