choco.palm.global.matching
Class PalmOccurence

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.global.Occurrence
                      extended by choco.palm.global.matching.PalmOccurence
All Implemented Interfaces:
Constraint, Entity, IntConstraint, IntVarEventListener, PalmIntVarListener, PalmConstraint, PalmVarListener, VarEventListener, Propagator, java.lang.Cloneable, java.util.EventListener

public class PalmOccurence
extends Occurrence
implements PalmConstraint, PalmIntVarListener


Field Summary
 
Fields inherited from class choco.global.Occurrence
constrainOnInfNumber, constrainOnSupNumber, isPossible, isSure, nbPossible, nbSure
 
Fields inherited from class choco.integer.constraints.AbstractLargeIntConstraint
cIndices, cste, vars
 
Fields inherited from class choco.AbstractConstraint
active, constAwakeEvent, hook, priority
 
Fields inherited from class choco.AbstractEntity
problem
 
Constructor Summary
PalmOccurence(IntDomainVar[] lvars, int occval, boolean onInf, boolean onSup)
           
 
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 awakeOnRem(int idx, int x)
          Default propagation on one value removal: propagation on domain revision.
 void awakeOnRestoreInf(int idx)
          Handles an inf bound restoration on the constraint idx
 void awakeOnRestoreSup(int idx)
          Handles a sup bound restoration on the constraint idx
 void awakeOnRestoreVal(int idx, int val)
          Handles a val restoration on the constraint idx
 void awakeOnRestoreVal(int idx, IntIterator it)
          Handles a val restoration on the constraint idx
 void awakeOnSup(int idx)
          Default propagation on improved upper bound: propagation on domain revision.
 void checkNbPossible()
           
 void checkNbSure()
           
 java.lang.Object clone()
          returns a copy of the constraint.
 void takeIntoAccountStatusChange(int index)
          Informs constraints that one of their children has a modified status (due to value restoration).
 void updateDataStructuresOnConstraint(int idx, int select, int newValue, int oldValue)
          Method called when one of the variables is modified.
 void updateDataStructuresOnRestoreConstraint(int idx, int select, int newValue, int oldValue)
          Method called when one of the variables has a restored value.
 java.util.Set whyIsFalse()
          When all variables are instantiated, explains why the wonstraint is false.
 java.util.Set whyIsTrue()
          When all variables are instantiated, explains why the wonstraint is true.
 
Methods inherited from class choco.global.Occurrence
awakeOnInst, filter, init, isSatisfied, pretty, propagate
 
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, awakeOnVar, connectVar, constAwake, delete, fail, getEvent, getPlugIn, getPriority, getProblem, getVarIdxInOpposite, isActive, isEntailed, isEquivalentTo, opposite, setActive, setEntailed, setPassive, setPlugIn, substituteVar
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface choco.Propagator
assignIndices, awakeOnVar, constAwake, delete, getEvent, getPlugIn, getPriority, isCompletelyInstantiated, isConsistent, isEntailed, propagate
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.Constraint
getConstraintIdx, getNbVars, getVar, getVarIdxInOpposite, isEquivalentTo, isSatisfied, opposite, setConstraintIndex, setVar
 
Methods inherited from interface choco.Entity
getProblem, pretty
 
Methods inherited from interface choco.palm.PalmVarListener
getConstraintIdx, setConstraintIndex
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.palm.PalmVarListener
getConstraintIdx, setConstraintIndex
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.integer.var.IntVarEventListener
awakeOnInst, getConstraintIdx, setConstraintIndex
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 

Constructor Detail

PalmOccurence

public PalmOccurence(IntDomainVar[] lvars,
                     int occval,
                     boolean onInf,
                     boolean onSup)
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 Occurrence
Returns:
Throws:
java.lang.CloneNotSupportedException

checkNbPossible

public void checkNbPossible()
                     throws ContradictionException
Overrides:
checkNbPossible in class Occurrence
Throws:
ContradictionException

checkNbSure

public void checkNbSure()
                 throws ContradictionException
Overrides:
checkNbSure in class Occurrence
Throws:
ContradictionException

updateDataStructuresOnConstraint

public void updateDataStructuresOnConstraint(int idx,
                                             int select,
                                             int newValue,
                                             int oldValue)
Description copied from interface: PalmVarListener
Method called when one of the variables is modified.

Specified by:
updateDataStructuresOnConstraint in interface PalmVarListener
Parameters:
idx - Index of the variable.
select - Type of modification (PalmIntVar.INF, PalmIntVar.SUP, PalmIntVar.VAL).
newValue - New value (or modified value).
oldValue - Old value (or 0 if this a value removal).

updateDataStructuresOnRestoreConstraint

public void updateDataStructuresOnRestoreConstraint(int idx,
                                                    int select,
                                                    int newValue,
                                                    int oldValue)
Description copied from interface: PalmVarListener
Method called when one of the variables has a restored value.

Specified by:
updateDataStructuresOnRestoreConstraint in interface PalmVarListener
Parameters:
idx - Index of the variable.
select - Type of modification.
newValue - New value (or modified value).
oldValue - Old value (or 0 if this a value removal).

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 Occurrence
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 Occurrence
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 Occurrence
Throws:
ContradictionException

awakeOnRestoreInf

public void awakeOnRestoreInf(int idx)
                       throws ContradictionException
Description copied from interface: PalmIntVarListener
Handles an inf bound restoration on the constraint idx

Specified by:
awakeOnRestoreInf in interface PalmIntVarListener
Parameters:
idx - Variable involved.
Throws:
ContradictionException

awakeOnRestoreSup

public void awakeOnRestoreSup(int idx)
                       throws ContradictionException
Description copied from interface: PalmIntVarListener
Handles a sup bound restoration on the constraint idx

Specified by:
awakeOnRestoreSup in interface PalmIntVarListener
Parameters:
idx - Variable involved.
Throws:
ContradictionException

awakeOnRestoreVal

public void awakeOnRestoreVal(int idx,
                              int val)
                       throws ContradictionException
Description copied from interface: PalmIntVarListener
Handles a val restoration on the constraint idx

Specified by:
awakeOnRestoreVal in interface PalmIntVarListener
Parameters:
idx - Variable involved.
Throws:
ContradictionException

awakeOnRestoreVal

public void awakeOnRestoreVal(int idx,
                              IntIterator it)
                       throws ContradictionException
Description copied from interface: PalmIntVarListener
Handles a val restoration on the constraint idx

Specified by:
awakeOnRestoreVal in interface PalmIntVarListener
Parameters:
idx - Variable involved.
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 Occurrence
Throws:
ContradictionException

whyIsTrue

public java.util.Set whyIsTrue()
Description copied from interface: PalmIntVarListener
When all variables are instantiated, explains why the wonstraint is true.

Specified by:
whyIsTrue in interface PalmIntVarListener
Returns:
A set of constraint justifying that the constraint is satisfied.

whyIsFalse

public java.util.Set whyIsFalse()
Description copied from interface: PalmIntVarListener
When all variables are instantiated, explains why the wonstraint is false.

Specified by:
whyIsFalse in interface PalmIntVarListener
Returns:
A set of constraint justifying that the constraint is not satisfied.

takeIntoAccountStatusChange

public void takeIntoAccountStatusChange(int index)
Description copied from interface: PalmConstraint
Informs constraints that one of their children has a modified status (due to value restoration).

Specified by:
takeIntoAccountStatusChange in interface PalmConstraint