|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectagg.util.csp.BinaryConstraint
public abstract class BinaryConstraint
An abstract class for binary constraints.
Field Summary | |
---|---|
protected Variable |
itsVar1
|
protected Variable |
itsVar2
|
protected int |
itsWeight
|
Constructor Summary | |
---|---|
BinaryConstraint(Variable v,
int weight)
Construct myself to be a "unary" constraint on v . |
|
BinaryConstraint(Variable v1,
Variable v2,
int weight)
Construct myself to be a binary constraint between variables v1 and v2 , with the specified
weight . |
Method Summary | |
---|---|
void |
activate()
Activate this constraint. |
abstract void |
clear()
|
void |
deactivate()
Deactivate this constraint. |
abstract boolean |
execute()
Check if the constraint is satisfied. |
Variable |
getCause(Variable rvar)
When execute() failed, this returns the variable that is
supposed to have caused the failure. |
Variable |
getVar1()
Return my first variable. |
Variable |
getVar2()
Return my second variable. |
int |
getWeight()
Return my weight. |
boolean |
isApplicable()
Return true iff all variables involved are instantiated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Variable itsVar1
protected Variable itsVar2
protected int itsWeight
Constructor Detail |
---|
public BinaryConstraint(Variable v1, Variable v2, int weight)
v1
and v2
, with the specified
weight
.
public BinaryConstraint(Variable v, int weight)
v
.
Actually, this is a BinaryConstraint with both its variables being
v
.
Method Detail |
---|
public abstract void clear()
public void activate()
public void deactivate()
public boolean isApplicable()
true
iff all variables involved are instantiated.
public abstract boolean execute()
Pre: isApplicable()
.
public Variable getCause(Variable rvar)
execute()
failed, this returns the variable that is
supposed to have caused the failure.
rvar
- the variable (of the two involved) that has been instantiated
most recently.public Variable getVar1()
public Variable getVar2()
public int getWeight()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |