choco.set.constraint
Class AbstractTernSetConstraint

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.AbstractConstraint
          extended by choco.set.constraint.AbstractSetConstraint
              extended by choco.set.constraint.AbstractTernSetConstraint
All Implemented Interfaces:
Constraint, Entity, VarEventListener, Propagator, SetConstraint, SetVarEventListener, java.lang.Cloneable, java.util.EventListener
Direct Known Subclasses:
SetIntersection

public abstract class AbstractTernSetConstraint
extends AbstractSetConstraint


Field Summary
 int cIdx0
          The index of the constraint among all listeners of its first variable.
 int cIdx1
          The index of the constraint among all listeners of its second variable.
 int cIdx2
          The index of the constraint among all listeners of its third variable.
 SetVar v0
          The first variable of the constraint.
 SetVar v1
          The second variable of the constraint.
 SetVar v2
          The third variable of the constraint.
 
Fields inherited from class choco.set.constraint.AbstractSetConstraint
logger
 
Fields inherited from class choco.AbstractConstraint
active, constAwakeEvent, hook, priority
 
Fields inherited from class choco.AbstractEntity
problem
 
Constructor Summary
AbstractTernSetConstraint()
           
 
Method Summary
 int assignIndices(AbstractCompositeConstraint root, int i, boolean dynamicAddition)
          performs the global numbering (wrt root) of the variables contained in the subtree this, starting from i
 int getConstraintIdx(int idx)
          Returns the index of the constraint in the specified variable.
 int getNbVars()
          Returns the number of variables.
 SetVar getSetVar(int i)
          Gets the ith search valued variable.
 Var getVar(int i)
          Gets the specified variable.
 boolean isCompletelyInstantiated()
          Checks if all the variables are instantiated.
 void setConstraintIndex(int i, int val)
          Let v be the i-th var of c, records that c is the n-th constraint involving v.
 void setVar(int i, Var v)
          Network management: Setting (or overwriting) the ith variable of a constraint.
 
Methods inherited from class choco.set.constraint.AbstractSetConstraint
awakeOnEnv, awakeOnEnvRemovals, awakeOnInst, awakeOnKer, awakeOnkerAdditions, getSelfIndex
 
Methods inherited from class choco.AbstractConstraint
addListener, awake, awakeOnVar, clone, connectVar, constAwake, delete, fail, getEvent, getPlugIn, getPriority, getProblem, getVarIdxInOpposite, isActive, isEntailed, isEquivalentTo, opposite, setActive, setEntailed, setPassive, setPlugIn, substituteVar
 
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
awake, awakeOnVar, constAwake, delete, getEvent, getPlugIn, getPriority, isConsistent, isEntailed, propagate
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 

Field Detail

v0

public SetVar v0
The first variable of the constraint.


v1

public SetVar v1
The second variable of the constraint.


v2

public SetVar v2
The third variable of the constraint.


cIdx0

public int cIdx0
The index of the constraint among all listeners of its first variable.


cIdx1

public int cIdx1
The index of the constraint among all listeners of its second variable.


cIdx2

public int cIdx2
The index of the constraint among all listeners of its third variable.

Constructor Detail

AbstractTernSetConstraint

public AbstractTernSetConstraint()
Method Detail

setConstraintIndex

public void setConstraintIndex(int i,
                               int val)
Let v be the i-th var of c, records that c is the n-th constraint involving v.

Parameters:
i - index of the variable in the constraint
val - index of the constraint in the among all listeners linked to that variable

getConstraintIdx

public int getConstraintIdx(int idx)
Returns the index of the constraint in the specified variable.

Parameters:
idx - index of the variable in the constraint

isCompletelyInstantiated

public boolean isCompletelyInstantiated()
Checks if all the variables are instantiated.

Specified by:
isCompletelyInstantiated in interface Propagator
Overrides:
isCompletelyInstantiated in class AbstractSetConstraint

getNbVars

public int getNbVars()
Returns the number of variables.


getVar

public Var getVar(int i)
Gets the specified variable.

Parameters:
i - index of the variable in the constraint

setVar

public void setVar(int i,
                   Var v)
Description copied from interface: Constraint
Network management: Setting (or overwriting) the ith variable of a constraint.

Parameters:
i - index of the variable in the constraint
v - the variable (may be an IntDomainVar, SetVar, RealVar, ...

getSetVar

public SetVar getSetVar(int i)
Gets the ith search valued variable.


assignIndices

public int assignIndices(AbstractCompositeConstraint root,
                         int i,
                         boolean dynamicAddition)
Description copied from interface: Propagator
performs the global numbering (wrt root) of the variables contained in the subtree this, starting from i

Parameters:
root - the overall root constraint, for which the variables are numbered
i - the index that will assigned to the first variable in the subtree this (originally 0)
dynamicAddition - whether the addition is undone automatically on backtracking
Returns:
the index of the last variable in the subtree