|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchoco.AbstractEntity
choco.AbstractConstraint
choco.bool.AbstractCompositeConstraint
choco.bool.AbstractBinCompositeConstraint
public abstract class AbstractBinCompositeConstraint
Abstract implementation of a composite constraint (like boolean ones) involving two sub-constraints.
Field Summary | |
---|---|
protected AbstractConstraint |
const0
The first sub-constraint of the composition. |
protected AbstractConstraint |
const1
The second sub-constraint of the composition. |
protected int |
offset
The number of variables in the first sub-constraint. |
Fields inherited from class choco.AbstractConstraint |
---|
active, constAwakeEvent, hook, priority |
Fields inherited from class choco.AbstractEntity |
---|
problem |
Constructor Summary | |
---|---|
AbstractBinCompositeConstraint(AbstractConstraint c1,
AbstractConstraint c2)
Builds a new binary composite constraint with the two specified sub-constraints. |
Method Summary | |
---|---|
int |
assignIndices(AbstractCompositeConstraint root,
int i,
boolean dynamicAddition)
Assigns indices to variables for the global constraint involving this one. |
java.lang.Object |
clone()
Builds a copy of this constraint. |
int |
getConstraintIdx(int i)
Returns the constraint index according to the variable i. |
IntDomainVar |
getIntVar(int varIdx)
Network management: Accessing the i-th search variable of a constraint. |
int |
getNbSubConstraints()
Returns the number of direct sub-constraints (2 here since this is a binary composite constraint). |
int |
getNbVars()
Determines the number of variables, that is the sum of all variables in sub-constraints. |
Constraint |
getSubConstraint(int constIdx)
Accesses the sub-constraints. |
int |
getSubConstraintIdx(int varIdx)
Returns the index of the sub-constraint involving the variable varIdx. |
Var |
getVar(int i)
Accesses the variable i. |
int |
getVarIdxInOpposite(int i)
Returns the variable indx in the opposite constraint. |
boolean |
isCompletelyInstantiated()
Checks if all variables are instantiated, that if sub-constraints variables are instantiated. |
void |
setConstraintIndex(int i,
int idx)
Sets the constraint index according to the variable i. |
void |
setVar(int i,
Var v)
Sets the variable i. |
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.Constraint |
---|
isEquivalentTo, isSatisfied, opposite |
Methods inherited from interface choco.Entity |
---|
getProblem, pretty |
Methods inherited from interface choco.integer.var.IntVarEventListener |
---|
awakeOnInf, awakeOnInst, awakeOnRem, awakeOnSup |
Methods inherited from interface choco.prop.VarEventListener |
---|
awakeOnVar, isActive, setActive, setPassive |
Methods inherited from interface choco.Propagator |
---|
isConsistent, propagate |
Field Detail |
---|
protected AbstractConstraint const0
protected AbstractConstraint const1
protected int offset
Constructor Detail |
---|
public AbstractBinCompositeConstraint(AbstractConstraint c1, AbstractConstraint c2)
c1
- the first sub-constraintc2
- the second sub-constraintMethod Detail |
---|
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in interface Constraint
clone
in class AbstractConstraint
java.lang.CloneNotSupportedException
- if an problem occurs when cloning
elements pf this constraintpublic int assignIndices(AbstractCompositeConstraint root, int i, boolean dynamicAddition)
root
- the global constraint including this onei
- the first available indexdynamicAddition
- states if the constraint is added definitively
public IntDomainVar getIntVar(int varIdx)
varIdx
- index of the variable among all search variables
in the constraint. Numbering start from 0 on.
public int getSubConstraintIdx(int varIdx)
varIdx
- the variable index
public int getVarIdxInOpposite(int i)
getVarIdxInOpposite
in interface Constraint
getVarIdxInOpposite
in class AbstractConstraint
i
- the variable index
public int getNbVars()
public Var getVar(int i)
i
- the index of the variable
public void setVar(int i, Var v)
i
- the variable indexv
- the variablepublic boolean isCompletelyInstantiated()
public int getConstraintIdx(int i)
i
- the variable index
public void setConstraintIndex(int i, int idx)
i
- the variable indexidx
- the requested constraint indexpublic Constraint getSubConstraint(int constIdx)
constIdx
- the constraint index (0 or 1 here)
public int getNbSubConstraints()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |