choco.bool
Interface CompositeConstraint

All Superinterfaces:
java.lang.Cloneable, Constraint, Entity, java.util.EventListener, IntVarEventListener, VarEventListener
All Known Subinterfaces:
BoolConstraint
All Known Implementing Classes:
AbstractBinBoolConstraint, AbstractBinBoolConstraintWithCounterOpposite, AbstractBinCompositeConstraint, AbstractCompositeConstraint, AbstractLargeBoolConstraint, AbstractLargeBoolConstraintWithCounterOpposite, AbstractLargeCompositeConstraint, BinConjunction, BinDisjunction, Cardinality, Equiv, Guard, LargeConjunction, LargeDisjunction

public interface CompositeConstraint
extends Constraint, IntVarEventListener

An interface for all implementations of listeners using search variables.


Method Summary
 int getGlobalVarIndex(Constraint subConstraint, int localVarIdx)
          returns the global index of a variable within a constraint
 int getNbSubConstraints()
          returns the number of sub-constraints that the composite constraint is made of
 Constraint getSubConstraint(int constIdx)
          accessor to the sub-constraints from which the composite constraint is made of
 int getSubConstraintIdx(int varIdx)
          return the index of the subconstraint where the i-th variable is referenced
 
Methods inherited from interface choco.Constraint
clone, getConstraintIdx, getNbVars, getVar, getVarIdxInOpposite, isEquivalentTo, isSatisfied, opposite, setConstraintIndex, setVar
 
Methods inherited from interface choco.Entity
getProblem, pretty
 
Methods inherited from interface choco.integer.var.IntVarEventListener
awakeOnInf, awakeOnInst, awakeOnRem, awakeOnSup, getConstraintIdx, setConstraintIndex
 
Methods inherited from interface choco.prop.VarEventListener
addListener, awakeOnVar, isActive, setActive, setPassive
 

Method Detail

getSubConstraintIdx

int getSubConstraintIdx(int varIdx)
return the index of the subconstraint where the i-th variable is referenced

Parameters:
varIdx - the overall index of the variable (among all variables of the combination
Returns:
the index of the subconstraint involving the variable or -1 if none can be found (which would be a definite bug !)

getSubConstraint

Constraint getSubConstraint(int constIdx)
accessor to the sub-constraints from which the composite constraint is made of

Parameters:
constIdx - the index of the constraint
Returns:
the appropriate subConstraint

getNbSubConstraints

int getNbSubConstraints()
returns the number of sub-constraints that the composite constraint is made of


getGlobalVarIndex

int getGlobalVarIndex(Constraint subConstraint,
                      int localVarIdx)
returns the global index of a variable within a constraint

Parameters:
subConstraint - the subconstraint (a node in the composition tree)
localVarIdx - the index of the variable, local to the subconstraint
Returns:
the index of the variable in the global numbering associated to the composition (this)