choco.integer.constraints
Class ElementV

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.AbstractConstraint
          extended by choco.integer.constraints.AbstractIntConstraint
              extended by choco.integer.constraints.AbstractLargeIntConstraint
                  extended by choco.integer.constraints.ElementV
All Implemented Interfaces:
Constraint, Entity, IntConstraint, IntVarEventListener, VarEventListener, Propagator, java.lang.Cloneable, java.util.EventListener

public class ElementV
extends AbstractLargeIntConstraint

A class implementing the constraint A[I] == X, with I and X being IntVars and A an array of IntVars


Field Summary
protected  StoredBool indexUpdateNeeded
           
protected  StoredBool valueUpdateNeeded
           
 
Fields inherited from class choco.integer.constraints.AbstractLargeIntConstraint
cIndices, cste, vars
 
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
ElementV(IntDomainVar[] vars, int offset)
           
 
Method Summary
 void awake()
          Default initial propagation: full constraint re-propagation.
 void awakeOnInf(int idx)
          Default propagation on improved lower bound: propagation on domain revision.
 void awakeOnInst(int idx)
          Default propagation on instantiation: full constraint re-propagation.
 void awakeOnRem(int idx, int x)
          Default propagation on one value removal: propagation on domain revision.
 void awakeOnSup(int idx)
          Default propagation on improved upper bound: propagation on domain revision.
 void awakeOnVar(int idx)
          Default propagation on variable revision: full constraint re-propagation.
 java.lang.Object clone()
          returns a copy of the constraint.
protected  void equalityBehaviour()
           
protected  IntDomainVar getIndexVar()
           
protected  IntDomainVar getValueVar()
           
 java.lang.Boolean isEntailed()
          Checks whether the constraint is definitely satisfied, no matter what further restrictions occur to the domain of its variables.
 boolean isSatisfied()
          Semantic: Testing if the constraint is satisfied.
 java.lang.String pretty()
          pretty printing of the object.
 void propagate()
          Propagates the constraint awake events.
 java.lang.String toString()
           
protected  void updateIndexFromValue()
           
protected  void updateValueFromIndex()
           
 
Methods inherited from class choco.integer.constraints.AbstractLargeIntConstraint
assignIndices, getConstraintIdx, getIntVar, getNbVars, getVar, isCompletelyInstantiated, setConstraintIndex, setVar
 
Methods inherited from class choco.integer.constraints.AbstractIntConstraint
awakeOnBounds, awakeOnRemovals, getSelfIndex, isConsistent
 
Methods inherited from class choco.AbstractConstraint
addListener, connectVar, constAwake, delete, fail, getEvent, getPlugIn, getPriority, getProblem, getVarIdxInOpposite, isActive, isEquivalentTo, opposite, setActive, setEntailed, setPassive, setPlugIn, substituteVar
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface choco.Propagator
constAwake, delete, getEvent, getPlugIn, getPriority
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 

Field Detail

valueUpdateNeeded

protected StoredBool valueUpdateNeeded

indexUpdateNeeded

protected StoredBool indexUpdateNeeded
Constructor Detail

ElementV

public ElementV(IntDomainVar[] vars,
                int offset)
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 AbstractLargeIntConstraint
Returns:
Throws:
java.lang.CloneNotSupportedException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

pretty

public java.lang.String pretty()
Description copied from interface: Entity
pretty printing of the object. This String is not constant and may depend on the context.

Specified by:
pretty in interface Entity
Overrides:
pretty in class AbstractEntity
Returns:
a readable string representation of the object

getIndexVar

protected IntDomainVar getIndexVar()

getValueVar

protected IntDomainVar getValueVar()

isSatisfied

public boolean isSatisfied()
Description copied from interface: Constraint
Semantic: Testing if the constraint is satisfied. Note that all variables involved in the constraint must be instantiated when this method is called.


updateValueFromIndex

protected void updateValueFromIndex()
                             throws ContradictionException
Throws:
ContradictionException

updateIndexFromValue

protected void updateIndexFromValue()
                             throws ContradictionException
Throws:
ContradictionException

equalityBehaviour

protected void equalityBehaviour()
                          throws ContradictionException
Throws:
ContradictionException

awake

public void awake()
           throws ContradictionException
Description copied from class: AbstractConstraint
Default initial propagation: full constraint re-propagation.

Specified by:
awake in interface Propagator
Overrides:
awake in class AbstractConstraint
Throws:
ContradictionException

propagate

public void propagate()
               throws ContradictionException
Description copied from class: AbstractLargeIntConstraint
Propagates the constraint awake events.

Specified by:
propagate in interface Propagator
Overrides:
propagate in class AbstractLargeIntConstraint
Throws:
ContradictionException

awakeOnInf

public void awakeOnInf(int idx)
                throws ContradictionException
Description copied from class: AbstractIntConstraint
Default propagation on improved lower bound: propagation on domain revision.

Specified by:
awakeOnInf in interface IntVarEventListener
Overrides:
awakeOnInf in class AbstractIntConstraint
Throws:
ContradictionException

awakeOnSup

public void awakeOnSup(int idx)
                throws ContradictionException
Description copied from class: AbstractIntConstraint
Default propagation on improved upper bound: propagation on domain revision.

Specified by:
awakeOnSup in interface IntVarEventListener
Overrides:
awakeOnSup in class AbstractIntConstraint
Throws:
ContradictionException

awakeOnInst

public void awakeOnInst(int idx)
                 throws ContradictionException
Description copied from class: AbstractIntConstraint
Default propagation on instantiation: full constraint re-propagation.

Specified by:
awakeOnInst in interface IntVarEventListener
Overrides:
awakeOnInst in class AbstractIntConstraint
Throws:
ContradictionException

awakeOnRem

public void awakeOnRem(int idx,
                       int x)
                throws ContradictionException
Description copied from class: AbstractIntConstraint
Default propagation on one value removal: propagation on domain revision.

Specified by:
awakeOnRem in interface IntVarEventListener
Overrides:
awakeOnRem in class AbstractIntConstraint
Throws:
ContradictionException

awakeOnVar

public void awakeOnVar(int idx)
                throws ContradictionException
Description copied from class: AbstractConstraint
Default propagation on variable revision: full constraint re-propagation.

Specified by:
awakeOnVar in interface VarEventListener
Specified by:
awakeOnVar in interface Propagator
Overrides:
awakeOnVar in class AbstractConstraint
Throws:
ContradictionException

isEntailed

public java.lang.Boolean isEntailed()
Description copied from interface: Propagator
Checks whether the constraint is definitely satisfied, no matter what further restrictions occur to the domain of its variables.

Specified by:
isEntailed in interface Propagator
Overrides:
isEntailed in class AbstractConstraint