V - VariableT - ValueC - Assignment Contextpublic abstract class BinaryConstraintWithContext<V extends Variable<V,T>,T extends Value<V,T>,C extends AssignmentConstraintContext<V,T>> extends BinaryConstraint<V,T> implements HasAssignmentContext<V,T,C>, CanHoldContext
ConstraintWithContext that extends the
BinaryConstraint class.AssignmentContextiConstraintListeners, iIdsMaxSize| Constructor and Description |
|---|
BinaryConstraintWithContext() |
| Modifier and Type | Method and Description |
|---|---|
void |
assigned(Assignment<V,T> assignment,
long iteration,
T value)
Given value is to be assigned to its variable.
|
AssignmentContextReference<V,T,C> |
getAssignmentContextReference()
Returns an assignment context reference
|
AssignmentContext[] |
getContext()
An array of
CanHoldContext.sMaxSize assignment contexts |
C |
getContext(Assignment<V,T> assignment)
Returns an assignment context associated with this constraint.
|
void |
setAssignmentContextReference(AssignmentContextReference<V,T,C> reference)
Store an assignment context reference that was given for the class by the
Model.createReference(HasAssignmentContext). |
void |
setModel(Model<V,T> model)
Sets the model which the constraint belongs to
|
void |
unassigned(Assignment<V,T> assignment,
long iteration,
T value)
Given value is unassigned from its variable.
|
addVariable, another, first, isFirst, secondaddConstraintListener, assignedVariables, compareTo, computeConflicts, computeConflictsNoForwardCheck, constraintListeners, countAssignedVariables, countVariables, equals, getDescription, getId, getModel, getName, hashCode, inConflict, isConsistent, isHard, removeConstraintListener, removeVariable, variablesclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitcreateAssignmentContextpublic BinaryConstraintWithContext()
public void setModel(Model<V,T> model)
Constraintpublic C getContext(Assignment<V,T> assignment)
HasAssignmentContext.createAssignmentContext(Assignment) method. From that time on,
this context is kept with the assignment and automatically updated by calling the
AssignmentConstraintContext.assigned(Assignment, Value) and AssignmentConstraintContext.unassigned(Assignment, Value)
whenever a variable of this constraint is changed.getContext in interface HasAssignmentContext<V extends Variable<V,T>,T extends Value<V,T>,C extends AssignmentConstraintContext<V,T>>assignment - given assignmentpublic AssignmentContextReference<V,T,C> getAssignmentContextReference()
HasAssignmentContextgetAssignmentContextReference in interface HasAssignmentContext<V extends Variable<V,T>,T extends Value<V,T>,C extends AssignmentConstraintContext<V,T>>Model.createReference(HasAssignmentContext) during initializationpublic void setAssignmentContextReference(AssignmentContextReference<V,T,C> reference)
HasAssignmentContextModel.createReference(HasAssignmentContext).setAssignmentContextReference in interface HasAssignmentContext<V extends Variable<V,T>,T extends Value<V,T>,C extends AssignmentConstraintContext<V,T>>reference - reference provided by the model by calling Model.createReference(HasAssignmentContext) during initializationpublic AssignmentContext[] getContext()
CanHoldContextCanHoldContext.sMaxSize assignment contextsgetContext in interface CanHoldContextpublic void assigned(Assignment<V,T> assignment, long iteration, T value)
Constraintpublic void unassigned(Assignment<V,T> assignment, long iteration, T value)
Constraintunassigned in class Constraint<V extends Variable<V,T>,T extends Value<V,T>>assignment - current assignmentiteration - current iterationvalue - unassigned value