|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchoco.AbstractEntity
choco.AbstractVar
public abstract class AbstractVar
An abstract class for all implementations of domain variables.
Field Summary | |
---|---|
protected PartiallyStoredVector |
constraints
The list of constraints (listeners) observing the variable. |
protected VarEvent |
event
The variable var associated to this variable. |
protected PartiallyStoredIntVector |
indices
List of indices encoding the constraint network. |
protected java.lang.String |
name
A name may be associated to each variable. |
Fields inherited from class choco.AbstractEntity |
---|
hook, problem |
Constructor Summary | |
---|---|
AbstractVar(AbstractProblem pb,
java.lang.String name)
Initializes a new variable. |
Method Summary | |
---|---|
int |
addConstraint(Constraint c,
int varIdx,
boolean dynamicAddition)
Adds a new constraints on the stack of constraints the addition can be dynamic (undone upon backtracking) or not. |
void |
eraseConstraint(Constraint c)
Removes (permanently) a constraint from the list of constraints connected to the variable. |
Constraint |
getConstraint(int i)
Retrieve the constraint i involving the variable. |
java.util.Iterator |
getConstraintsIterator()
This methods should be used if one want to access the different constraints currently posted on this variable. |
PartiallyStoredVector |
getConstraintVector()
Access the data structure storing constraints involving a given variable. |
VarEvent |
getEvent()
Returns the variable event. |
PartiallyStoredIntVector |
getIndexVector()
Access the data structure storing indices associated to constraints involving a given variable. |
int |
getNbConstraints()
Returns the number of constraints involving the variable. |
int |
getVarIndex(int constraintIndex)
Returns the index of the variable in its constraint i. |
java.lang.String |
toString()
Useful for debugging. |
Methods inherited from class choco.AbstractEntity |
---|
getProblem, pretty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface choco.Var |
---|
fail, isInstantiated |
Methods inherited from interface choco.Entity |
---|
getProblem, pretty |
Field Detail |
---|
protected java.lang.String name
protected VarEvent event
protected PartiallyStoredVector constraints
protected PartiallyStoredIntVector indices
Constructor Detail |
---|
public AbstractVar(AbstractProblem pb, java.lang.String name)
pb
- The problem this variable belongs toname
- The name of the variableMethod Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public VarEvent getEvent()
getEvent
in interface Var
public Constraint getConstraint(int i)
getConstraint
in interface Var
i
- the number of the required constraint
public int getNbConstraints()
getNbConstraints
in interface Var
public PartiallyStoredVector getConstraintVector()
getConstraintVector
in interface Var
public PartiallyStoredIntVector getIndexVector()
getIndexVector
in interface Var
public int getVarIndex(int constraintIndex)
getVarIndex
in interface Var
constraintIndex
- the index of the constraint
(among all constraints linked to the variable)
public void eraseConstraint(Constraint c)
c
- the constraint that should be removed from the list this variable
maintains.public int addConstraint(Constraint c, int varIdx, boolean dynamicAddition)
addConstraint
in interface Var
c
- the constraint to addvarIdx
- the variable index accrding to the added constraintdynamicAddition
- states if the addition is definitic (cut) or
subject to backtracking (standard constraint)
public java.util.Iterator getConstraintsIterator()
remove
method throws an
UnsupportedOperationException
.
getConstraintsIterator
in interface Var
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |