public abstract class Constraint
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Variables involved in the constraint.
An important subclass is BinaryConstraint, which provides support for constraints
whose scope has size two.| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Object |
annotation |
protected boolean |
autoRemovable |
protected java.awt.Paint |
color |
protected int |
id |
protected java.util.logging.Logger |
logger |
protected boolean |
masked |
static int |
numIDs
Progressive ID of a constraint
|
protected Variable[] |
scope |
| Constructor and Description |
|---|
Constraint() |
| Modifier and Type | Method and Description |
|---|---|
abstract java.lang.Object |
clone() |
java.lang.Object |
getAnnotation()
Get this
Constraint's annotation (can be any Object and used in any way). |
java.awt.Paint |
getColor() |
java.lang.String |
getDescription()
Get the description of this
Constraint's type. |
abstract java.lang.String |
getEdgeLabel()
Every
Constraint should implement this method - its value is
what is drawn by the ConstraintNetwork rendering methods. |
int |
getID()
Returns the ID of this
Constraint. |
Variable[] |
getScope()
Returns the scope of this
Constraint. |
boolean |
isAutoRemovable() |
abstract boolean |
isEquivalent(Constraint c)
Method for assessing the "equivalence" between two constraints.
|
boolean |
isMasked()
Returns
true iff this Constraint is invisible to the solver (masked). |
boolean |
isSkippableSolver(ConstraintSolver cs)
Assess whether a given solver is allowed to process this constraint.
|
boolean |
isUnary()
|
void |
mask()
Makes this
Constraint invisible to the solver (masked). |
void |
setAnnotation(java.lang.Object o)
Set this
Constraint's annotation (can be any Object and used in any way). |
void |
setAutoRemovable(boolean autoRemovable) |
void |
setColor(java.awt.Paint color) |
void |
setScope(Variable[] scope)
Set the scope of this
Constraint to a given array of Variables. |
void |
skipSolver(ConstraintSolver... solvers)
Provide a list of solvers that should not process this constraint.
|
abstract java.lang.String |
toString()
Every
Constraint should implement a toString method (used by the
ConstraintNetwork rendering methods). |
void |
unmask()
Makes this
Constraint invisible to the solver (masked). |
public static int numIDs
protected boolean masked
protected int id
protected Variable[] scope
protected java.lang.Object annotation
protected boolean autoRemovable
protected java.awt.Paint color
protected transient java.util.logging.Logger logger
public void skipSolver(ConstraintSolver... solvers)
solvers - Solvers that should not process this constraint.public boolean isMasked()
true iff this Constraint is invisible to the solver (masked).true iff this Constraint is invisible to the solver (masked).public void mask()
Constraint invisible to the solver (masked).public void unmask()
Constraint invisible to the solver (masked).public boolean isUnary()
true iff this Constraint's scope only refers to one Variable.public boolean isSkippableSolver(ConstraintSolver cs)
cs - The ConstraintSolver to check.true iff the given solver will process this constraint.public java.lang.Object getAnnotation()
Constraint's annotation (can be any Object and used in any way).Constraint's annotation.public void setAnnotation(java.lang.Object o)
Constraint's annotation (can be any Object and used in any way).o - This Constraint's annotation.public int getID()
Constraint.Constraint.public abstract java.lang.String toString()
Constraint should implement a toString method (used by the
ConstraintNetwork rendering methods).toString in class java.lang.ObjectString representation of this Constraint.public abstract java.lang.String getEdgeLabel()
Constraint should implement this method - its value is
what is drawn by the ConstraintNetwork rendering methods.String representation of the constraint to be used for
ConstraintNetwork rendering.public Variable[] getScope()
Constraint.Constraint (an array of size 2 if this is a
BinaryConstraint).public void setScope(Variable[] scope)
Constraint to a given array of Variables.scope - The desired new scope of this Constraint.public abstract java.lang.Object clone()
clone in class java.lang.Objectpublic abstract boolean isEquivalent(Constraint c)
c - The Constraint to compare against.true iff the two constraints are considered to be equivalent.public java.lang.String getDescription()
Constraint's type.Constraint's type.public boolean isAutoRemovable()
public void setAutoRemovable(boolean autoRemovable)
public java.awt.Paint getColor()
public void setColor(java.awt.Paint color)