choco.palm.dbt.explain
Class PalmConstraintPlugin

java.lang.Object
  extended by choco.palm.dbt.explain.PalmConstraintPlugin
All Implemented Interfaces:
ExplainedConstraintPlugin, ConstraintPlugin

public class PalmConstraintPlugin
extends java.lang.Object
implements ExplainedConstraintPlugin


Field Summary
protected  boolean depending
          States if the constraint is depending, that is depends on the validity of other constraints.
protected  boolean ephemeral
          States if the constraint is ephemeral (that is must be erased as soon a removed from the constraint net).
 
Constructor Summary
PalmConstraintPlugin(AbstractConstraint constraint)
          Constructs a plugin for a constraint.
 
Method Summary
 void activateListener()
          Reacts when this listener is reactivated.
 void addControl(Constraint father, int index)
          Adds a controlling constraint.
 void addDependency(ConstraintCollection e)
          Adds the explain of a depending filtering decision.
 void addListener()
          Reacts when this constraint is added as listener on each involved variable.
 void deactivateListener()
          Reacts when this listener is deactivated.
 int getConstraintIdx()
           
 java.util.Set getDependencyNet()
           
static int getLastTimeStamp()
          Returns the last affected time stamp
 SearchInfo getSearchInfo()
           
 int getTimeStamp()
          Time stamp of the last activation.
 int getWeight()
          Gets the weight of the constraint.
 void informControllersOfDeactivation()
          Informs all the constrolling constraints of modifications on this one.
 boolean isDepending()
          Checks if the constraint is depending.
 boolean isEphemeral()
           
 boolean isEverConnected()
          Checks if this constraint is ever connected.
 boolean isIndirect()
          Checks if the constraint is indirect.
 void removeDependance()
          Removes indirect dependance of this constraint: it updates the depending constraints list of all the constraints this one depends on.
 void removeDependency(ConstraintCollection e)
          Removes the explain of a depending filtering decision.
 void self_explain(Explanation e)
          Computes the explain associated to this constraint: either this constraint itself if direct, or the addingExplanation if indirect.
 void setConstraintIdx(int nb)
          Sets the constraint number during the post of teh variable.
 void setDependance()
          Sets indirect dependance of this constraint: it updates the depending constraints list of all the constraints this one depends on.
 void setDepending(PalmExplanation e)
          Sets the constraint depending.
 void setDirect()
          Sets the constraint direct.
 void setEphemeral(boolean ephemeral)
           
 void setIndirect(PalmExplanation e)
          Sets the constraint indirect.
 void setSearchInfo(SearchInfo searchInfo)
           
 void setWeight(int weight)
          Sets the weight of the constraint.
 void undo()
          Removes past effects of the constraint in order to remove it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

depending

protected boolean depending
States if the constraint is depending, that is depends on the validity of other constraints.


ephemeral

protected boolean ephemeral
States if the constraint is ephemeral (that is must be erased as soon a removed from the constraint net).

Constructor Detail

PalmConstraintPlugin

public PalmConstraintPlugin(AbstractConstraint constraint)
Constructs a plugin for a constraint.

Parameters:
constraint - The constraint this plugin is created for. It should be a PalmConstraint.
Method Detail

getConstraintIdx

public int getConstraintIdx()
Returns:
The associated number (determined when posting)

setConstraintIdx

public void setConstraintIdx(int nb)
Sets the constraint number during the post of teh variable.

Parameters:
nb - Number affected to the constraint.

addDependency

public void addDependency(ConstraintCollection e)
Adds the explain of a depending filtering decision.

Parameters:
e - The explain of the filtering decision.

removeDependency

public void removeDependency(ConstraintCollection e)
Removes the explain of a depending filtering decision.

Parameters:
e - The explain of the filtering decision.

undo

public void undo()
Removes past effects of the constraint in order to remove it.


isIndirect

public boolean isIndirect()
Checks if the constraint is indirect.


setIndirect

public void setIndirect(PalmExplanation e)
Sets the constraint indirect.

Parameters:
e - The explain containing all the constraint this one depends on.

isDepending

public boolean isDepending()
Checks if the constraint is depending.


setDepending

public void setDepending(PalmExplanation e)
Sets the constraint depending.


setDirect

public void setDirect()
Sets the constraint direct.


setDependance

public void setDependance()
Sets indirect dependance of this constraint: it updates the depending constraints list of all the constraints this one depends on.


removeDependance

public void removeDependance()
Removes indirect dependance of this constraint: it updates the depending constraints list of all the constraints this one depends on.


informControllersOfDeactivation

public void informControllersOfDeactivation()
Informs all the constrolling constraints of modifications on this one.


addControl

public void addControl(Constraint father,
                       int index)
Adds a controlling constraint.

Parameters:
father - A new controlling constraint.
index - The index of this constraint in the controlling one.

self_explain

public void self_explain(Explanation e)
Computes the explain associated to this constraint: either this constraint itself if direct, or the addingExplanation if indirect.

Specified by:
self_explain in interface ExplainedConstraintPlugin
Parameters:
e - The explain on which this explain should be merged.

addListener

public void addListener()
Reacts when this constraint is added as listener on each involved variable.

Specified by:
addListener in interface ConstraintPlugin

activateListener

public void activateListener()
Reacts when this listener is reactivated.

Specified by:
activateListener in interface ConstraintPlugin

deactivateListener

public void deactivateListener()
Reacts when this listener is deactivated.

Specified by:
deactivateListener in interface ConstraintPlugin

isEverConnected

public boolean isEverConnected()
Checks if this constraint is ever connected.


getWeight

public int getWeight()
Gets the weight of the constraint.

Returns:
The weight contained in this plugin.

setWeight

public void setWeight(int weight)
Sets the weight of the constraint.

Parameters:
weight - The new weight.

getTimeStamp

public int getTimeStamp()
Time stamp of the last activation.


getLastTimeStamp

public static int getLastTimeStamp()
Returns the last affected time stamp


setSearchInfo

public void setSearchInfo(SearchInfo searchInfo)

getSearchInfo

public SearchInfo getSearchInfo()

getDependencyNet

public java.util.Set getDependencyNet()

isEphemeral

public boolean isEphemeral()

setEphemeral

public void setEphemeral(boolean ephemeral)