|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchoco.kernel.solver.variables.AbstractVar
public abstract class AbstractVar
An abstract class for all implementations of domain variables.
Field Summary | |
---|---|
protected APartiallyStoredCstrList<? extends SConstraint> |
constraints
The list of constraints (listeners) observing the variable. |
protected VarEvent<? extends Var> |
event
The variable var associated to this variable. |
Extension[] |
extensions
The extensions of this constraint, in order to add some data linked to this constraint (for specific algorithms) |
protected String |
name
A name may be associated to each variable. |
protected PropagationEngine |
propagationEngine
|
Fields inherited from interface choco.kernel.solver.variables.Var |
---|
LOGGER |
Constructor Summary | |
---|---|
AbstractVar(Solver solver,
String name,
APartiallyStoredCstrList<? extends SConstraint> constraints)
Initializes a new variable. |
Method Summary | |
---|---|
int |
addConstraint(SConstraint 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 |
addExtension(int extensionNumber)
Adds a new extension. |
void |
eraseConstraint(SConstraint c)
Removes (permanently) a constraint from the list of constraints connected to the variable. |
static int |
getAbstractVarExtensionNumber(String name)
Returns a new number of extension registration |
SConstraint |
getConstraint(int i)
Retrieve the constraint i involving the variable. |
DisposableIterator<SConstraint> |
getConstraintsIterator()
This methods should be used if one want to access the different constraints currently posted on this variable. |
PartiallyStoredVector<? extends SConstraint> |
getConstraintVector()
Access the data structure storing constraints involving a given variable. |
VarEvent<? extends Var> |
getEvent()
Returns the variable event. |
Extension |
getExtension(int extensionNumber)
Returns the queried extension |
long |
getIndex()
Unique index (Different from hashCode, can change from one execution to another one) |
PartiallyStoredIntVector |
getIndexVector()
Access the data structure storing indices associated to constraints involving a given variable. |
String |
getName()
|
int |
getNbConstraints()
Returns the number of constraints involving the variable. |
int |
getPriority()
Return the priority of this according to the related constraints (minimum over all constraints priority) |
int |
getVarIndex(int constraintIndex)
Returns the index of the variable in its constraint i. |
int |
hashCode()
|
String |
toString()
Useful for debugging. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface choco.kernel.solver.variables.Var |
---|
isInstantiated |
Methods inherited from interface choco.IPretty |
---|
pretty |
Field Detail |
---|
protected PropagationEngine propagationEngine
protected String name
protected VarEvent<? extends Var> event
protected APartiallyStoredCstrList<? extends SConstraint> constraints
public Extension[] extensions
Constructor Detail |
---|
public AbstractVar(Solver solver, String name, APartiallyStoredCstrList<? extends SConstraint> constraints)
solver
- The model this variable belongs toname
- The name of the variableconstraints
- constraints stored specific structureMethod Detail |
---|
public static int getAbstractVarExtensionNumber(String name)
name
- A name for the extension (should be an UID, like the absolute path for instance)
public String getName()
getName
in interface Var
public int hashCode()
hashCode
in class Object
public final long getIndex()
getIndex
in interface IIndex
public final int getPriority()
Var
this
according to the related constraints (minimum over all constraints priority)
getPriority
in interface Var
public void addExtension(int extensionNumber)
addExtension
in interface IExtensionnable
extensionNumber
- should use the number returned by getAbstractSConstraintExtensionNumberpublic Extension getExtension(int extensionNumber)
getExtension
in interface IExtensionnable
extensionNumber
- should use the number returned by getAbstractSConstraintExtensionNumber
public String toString()
toString
in class Object
public VarEvent<? extends Var> getEvent()
getEvent
in interface Var
public SConstraint getConstraint(int i)
getConstraint
in interface Var
i
- the number of the required constraint
public int getNbConstraints()
getNbConstraints
in interface Var
public PartiallyStoredVector<? extends SConstraint> 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(SConstraint c)
c
- the constraint that should be removed from the list this variable
maintains.public int addConstraint(SConstraint 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 DisposableIterator<SConstraint> 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 |