choco.integer.constraints
Class AbstractLargeIntConstraint

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.AbstractConstraint
          extended by choco.integer.constraints.AbstractIntConstraint
              extended by choco.integer.constraints.AbstractLargeIntConstraint
All Implemented Interfaces:
Constraint, Entity, IntConstraint, IntVarEventListener, VarEventListener, Propagator, java.lang.Cloneable, java.util.EventListener
Direct Known Subclasses:
AbstractBipartiteGraph, AbstractPalmLargeIntConstraint, BoundAllDiff, CspLargeConstraint, Cumulative, ElementV, IntLinComb, InverseChanneling, Lex, Occurrence

public abstract class AbstractLargeIntConstraint
extends AbstractIntConstraint

An abstract class for all implementations of listeners over many search variables.


Field Summary
 int[] cIndices
          The list, containing, for each variable, the index of the constraint among all its incident listeners.
 int cste
          The search constant attached to the constraint.
 IntDomainVar[] vars
          The list of variables of the constraint.
 
Fields inherited from class choco.integer.constraints.AbstractIntConstraint
logger
 
Fields inherited from class choco.AbstractConstraint
active, constAwakeEvent, hook, priority
 
Fields inherited from class choco.AbstractEntity
problem
 
Constructor Summary
AbstractLargeIntConstraint(int n)
          Deprecated. use AbstractLargeIntConstraint(IntDomainVar[] vars) instead
AbstractLargeIntConstraint(IntDomainVar[] vars)
           
 
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
 java.lang.Object clone()
          returns a copy of the constraint.
 int getConstraintIdx(int i)
          Returns the index of the constraint in the specified variable.
 IntDomainVar getIntVar(int i)
          Gets the ith search valued variable.
 int getNbVars()
          Returns the number of variables.
 Var getVar(int i)
          Returns the ith variable.
 boolean isCompletelyInstantiated()
          Checks wether all the variables are instantiated.
 void propagate()
          Propagates the constraint awake events.
 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.integer.constraints.AbstractIntConstraint
awakeOnBounds, awakeOnInf, awakeOnInst, awakeOnRem, awakeOnRemovals, awakeOnSup, getSelfIndex, isConsistent
 
Methods inherited from class choco.AbstractConstraint
addListener, awake, awakeOnVar, 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, isEntailed
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 

Field Detail

vars

public IntDomainVar[] vars
The list of variables of the constraint.


cIndices

public int[] cIndices
The list, containing, for each variable, the index of the constraint among all its incident listeners.


cste

public int cste
The search constant attached to the constraint.

Constructor Detail

AbstractLargeIntConstraint

public AbstractLargeIntConstraint(int n)
Deprecated. use AbstractLargeIntConstraint(IntDomainVar[] vars) instead

constructor: allocates the data util for n variables

Parameters:
n - the number of variables involved in the constraint

AbstractLargeIntConstraint

public AbstractLargeIntConstraint(IntDomainVar[] vars)
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Description copied from interface: Constraint
returns a copy of the constraint. This copy is a new object, may be a recursive copy in case of composite constraints. The original and the copy share the same variables & plugins

Specified by:
clone in interface Constraint
Overrides:
clone in class AbstractConstraint
Returns:
Throws:
java.lang.CloneNotSupportedException

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 i)
Returns the index of the constraint in the specified variable.

Parameters:
i - index of the variable in the constraint

isCompletelyInstantiated

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

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

getNbVars

public int getNbVars()
Returns the number of variables.


getVar

public Var getVar(int i)
Returns the ith 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, ...

propagate

public void propagate()
               throws ContradictionException
Propagates the constraint awake events.

Throws:
ContradictionException

getIntVar

public IntDomainVar getIntVar(int i)
Gets the ith search valued variable.

Parameters:
i - index of the variable among all search variables in the constraint. Numbering start from 0 on.
Returns:
the variable, or null when no such variable is found

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