choco.kernel.solver.variables
Interface Var

All Superinterfaces:
IExtensionnable, IIndex, IPretty
All Known Subinterfaces:
IntDomainVar, IntVar, RealConstant, RealVar, SetVar
All Known Implementing Classes:
AbstractBijectiveVar, AbstractVar, BooleanVarImpl, BoolVarNot, IntDomainVarAddCste, IntDomainVarImpl, IntDomainVarTimePosCste, RealIntervalConstant, RealVarImpl, SetVarImpl, TaskVar, ViewIntDomainVarImpl

public interface Var
extends IPretty, IIndex, IExtensionnable

Interface for all implementations of domain variables.


Field Summary
static Logger LOGGER
          Reference to an object for logging trace statements related to IntDomainVar (using the java.util.logging package)
 
Method Summary
 int addConstraint(SConstraint c, int varIdx, boolean dynamicAddition)
          Adds a new listener for the variable, that is a constraint which should be informed as soon as the variable domain is modified.
 SConstraint getConstraint(int i)
          Returns the ith constraint.
 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 object used by the propagation engine to model a propagation event associated to the variable (an update to its domain)
 PartiallyStoredIntVector getIndexVector()
          access the data structure storing indices associated to constraints involving a given variable
 String getName()
           
 int getNbConstraints()
          Returns the number of listeners 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 it i-th constraint
 boolean isInstantiated()
          Public user API: Domains : testing whether a variable is instantiated or not.
 
Methods inherited from interface choco.IPretty
pretty
 
Methods inherited from interface choco.kernel.common.IIndex
getIndex
 
Methods inherited from interface choco.IExtensionnable
addExtension, getExtension
 

Field Detail

LOGGER

static final Logger LOGGER
Reference to an object for logging trace statements related to IntDomainVar (using the java.util.logging package)

Method Detail

getName

String getName()

getNbConstraints

int getNbConstraints()
Returns the number of listeners involving the variable.

Returns:
the numbers of listeners involving the variable

getConstraint

SConstraint getConstraint(int i)
Returns the ith constraint. i should be more than or equal to 0, and less or equal to the number of constraint minus 1.

Parameters:
i - number of constraint to be returned
Returns:
the ith constraint

getVarIndex

int getVarIndex(int constraintIndex)
returns the index of the variable in it i-th constraint

Parameters:
constraintIndex - the index of the constraint (among all constraints linked to the variable)
Returns:
the index of the variable (0 if this is the first variable of that constraint)

getConstraintVector

PartiallyStoredVector<? extends SConstraint> getConstraintVector()
access the data structure storing constraints involving a given variable

Returns:
the vector of constraints

getIndexVector

PartiallyStoredIntVector getIndexVector()
access the data structure storing indices associated to constraints involving a given variable

Returns:
the vector of index

isInstantiated

boolean isInstantiated()
Public user API: Domains : testing whether a variable is instantiated or not.

Returns:
a boolean giving if a variable is instanciated or not

addConstraint

int addConstraint(SConstraint c,
                  int varIdx,
                  boolean dynamicAddition)
Adds a new listener for the variable, that is a constraint which should be informed as soon as the variable domain is modified. The addition can be dynamic (undone upon backtracking) or not

Parameters:
c - the constraint to add
varIdx - index of the variable
dynamicAddition - dynamical addition or not
Returns:
the number of the listener

getEvent

VarEvent<? extends Var> getEvent()
returns the object used by the propagation engine to model a propagation event associated to the variable (an update to its domain)

Returns:
the propagation event

getConstraintsIterator

DisposableIterator<SConstraint> getConstraintsIterator()
This methods should be used if one want to access the different constraints currently posted on this variable.

Indeed, since indices are not always consecutive, it is the only simple way to achieve this.

Returns:
an iterator over all constraints involving this variable

getPriority

int getPriority()
Return the priority of this according to the related constraints (minimum over all constraints priority)

Returns:


Copyright © 2012. All Rights Reserved.