choco.bool
Class AbstractBinBoolConstraint

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.AbstractConstraint
          extended by choco.bool.AbstractCompositeConstraint
              extended by choco.bool.AbstractBinCompositeConstraint
                  extended by choco.bool.AbstractBinBoolConstraint
All Implemented Interfaces:
BoolConstraint, CompositeConstraint, Constraint, Entity, IntConstraint, IntVarEventListener, VarEventListener, Propagator, java.lang.Cloneable, java.util.EventListener
Direct Known Subclasses:
AbstractBinBoolConstraintWithCounterOpposite, BinDisjunction, Guard

public abstract class AbstractBinBoolConstraint
extends AbstractBinCompositeConstraint
implements BoolConstraint

An abstract class for binary Boolean composition


Field Summary
protected  StoredInt statusBitVector
          using a bitvector to store four three-valued data (true, false, unknown): status/targetStatus of c.const0/2 Each data is stored on two bits: - the first bit indicates whether the data is known or unknown - the second bit indicates whether the data is true or false Therefore, the second bit is meaningful only when the first one is true.
 
Fields inherited from class choco.bool.AbstractBinCompositeConstraint
const0, const1, offset
 
Fields inherited from class choco.AbstractConstraint
active, constAwakeEvent, hook, priority
 
Fields inherited from class choco.AbstractEntity
problem
 
Constructor Summary
AbstractBinBoolConstraint(AbstractConstraint c1, AbstractConstraint c2)
           
 
Method Summary
 java.lang.Object clone()
          Builds a copy of this constraint.
 java.lang.Boolean getStatus(int constIdx)
          returns the current status of one of its subconstraints
 java.lang.Boolean getTargetStatus(int constIdx)
          returns the current target status of one of its subconstraints
 void setStatus(int constIdx, boolean st)
          updates the status of one of its subconstraints
 void setSubConstraintStatus(Constraint subConstraint, boolean status, int varOffset)
          records that the status of a subConstraint is now true
 void setTargetStatus(int constIdx, boolean st)
          updates the target status of one of its subconstraints
 
Methods inherited from class choco.bool.AbstractBinCompositeConstraint
assignIndices, getConstraintIdx, getIntVar, getNbSubConstraints, getNbVars, getSubConstraint, getSubConstraintIdx, getVar, getVarIdxInOpposite, isCompletelyInstantiated, setConstraintIndex, setVar
 
Methods inherited from class choco.bool.AbstractCompositeConstraint
addListener, awakeOnBounds, awakeOnRemovals, getGlobalVarIndex
 
Methods inherited from class choco.AbstractConstraint
awake, awakeOnVar, connectVar, constAwake, delete, fail, getEvent, getPlugIn, getPriority, getProblem, 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.bool.CompositeConstraint
getGlobalVarIndex, getNbSubConstraints, getSubConstraint, getSubConstraintIdx
 
Methods inherited from interface choco.integer.var.IntVarEventListener
awakeOnInf, awakeOnInst, awakeOnRem, awakeOnSup, getConstraintIdx, setConstraintIndex
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.integer.IntConstraint
awakeOnBounds, awakeOnRemovals, getIntVar
 
Methods inherited from interface choco.Propagator
assignIndices, awake, 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.integer.var.IntVarEventListener
awakeOnInf, awakeOnInst, awakeOnRem, awakeOnSup, getConstraintIdx, setConstraintIndex
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 

Field Detail

statusBitVector

protected StoredInt statusBitVector
using a bitvector to store four three-valued data (true, false, unknown): status/targetStatus of c.const0/2 Each data is stored on two bits: - the first bit indicates whether the data is known or unknown - the second bit indicates whether the data is true or false Therefore, the second bit is meaningful only when the first one is true.

Constructor Detail

AbstractBinBoolConstraint

public AbstractBinBoolConstraint(AbstractConstraint c1,
                                 AbstractConstraint c2)
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Description copied from class: AbstractBinCompositeConstraint
Builds a copy of this constraint.

Specified by:
clone in interface Constraint
Overrides:
clone in class AbstractBinCompositeConstraint
Returns:
a copy of this constraint
Throws:
java.lang.CloneNotSupportedException - if an problem occurs when cloning elements pf this constraint

getStatus

public java.lang.Boolean getStatus(int constIdx)
Description copied from interface: BoolConstraint
returns the current status of one of its subconstraints

Specified by:
getStatus in interface BoolConstraint
Parameters:
constIdx - the index of the subconstraint
Returns:
Boolean.TRUE if the subconstraint is entailed, Boolean.FALSE if it is violated, NULL otherwise

getTargetStatus

public java.lang.Boolean getTargetStatus(int constIdx)
Description copied from interface: BoolConstraint
returns the current target status of one of its subconstraints

Specified by:
getTargetStatus in interface BoolConstraint
Parameters:
constIdx - the index of the subconstraint
Returns:
Boolean.TRUE if the subconstraint must be satisfied (thus propagated), Boolean.FALSE if it must be violated (thus counter-propagated), NULL otherwise

setStatus

public void setStatus(int constIdx,
                      boolean st)
Description copied from interface: BoolConstraint
updates the status of one of its subconstraints

Specified by:
setStatus in interface BoolConstraint
Parameters:
constIdx - the index of the subconstraint
st - true if the subconstraint is entailed, false if it is violated

setTargetStatus

public void setTargetStatus(int constIdx,
                            boolean st)
Description copied from interface: BoolConstraint
updates the target status of one of its subconstraints

Specified by:
setTargetStatus in interface BoolConstraint
Parameters:
constIdx - the index of the subconstraint
st - true if the subconstraint must be satisfied (thus propagated), false if it must be violated (thus counter-propagated)

setSubConstraintStatus

public void setSubConstraintStatus(Constraint subConstraint,
                                   boolean status,
                                   int varOffset)
Description copied from interface: BoolConstraint
records that the status of a subConstraint is now true

Specified by:
setSubConstraintStatus in interface BoolConstraint
Parameters:
subConstraint - the subconstraint
status - the new value of the status to be recorded
varOffset - the offset for the local variable indexing in the subConstraint wrt the global numbering in this