|
CIDER Toolkit Version 0.1.0-beta |
|||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
A constraint essentially defines a mathematical relationship,
such as x < y + 3 (where each side of the <
sign can be thought of as a ConstraintExpression).
This interface defines how a constraint is manipulated. Classes that
implement this interface should also define a no-argument constructor
and must be Serializable.
| Method Summary | |
java.util.Set |
getConstraintVariables()
Returns a set containing all the constraint variables used by this constraint. |
double |
getWeight()
Returns the weight of this constraint. |
void |
initialize(java.lang.String constraint,
ConstraintVariable[] variables)
Initializes the constraint from a string. |
void |
initializeConstant(ConstraintVariable variable,
double constant)
Initializes a constraint of the form: variable == constant |
void |
initializeWithEqualsRelationship(ConstraintVariable variable,
ConstraintExpression expression)
Initializes a constraint of the form: variable == expression |
boolean |
isSatisfied(double tolerance)
Returns true if and only if the solved values of the constraint variables
satisfy this constraint within the specified tolerance amount. |
void |
setWeight(double weight)
Sets the weight of this constraint. |
| Method Detail |
public void initialize(java.lang.String constraint,
ConstraintVariable[] variables)
throws CannotProcessConstraintException,
java.lang.ArrayIndexOutOfBoundsException,
java.lang.NumberFormatException
constraint - A string that defines the constraint (this string needs to be parsed).variables - An array of constraint variables that the constraint string refers to.
CannotProcessConstraintException - If string cannot be parsed.
java.lang.ArrayIndexOutOfBoundsException - If an illegal access of the constraint variable array is attempted.
java.lang.NumberFormatException - If an illegal number format is found in the string being parsed.
public void initializeWithEqualsRelationship(ConstraintVariable variable,
ConstraintExpression expression)
variable == expression
variable - The variable to be used in defining the equals relationship.expression - The expression to be used in defining the equals relationship.
public void initializeConstant(ConstraintVariable variable,
double constant)
variable == constant
variable - The variable to be used in defining the equals relationship.constant - The constant value.public boolean isSatisfied(double tolerance)
true if and only if the solved values of the constraint variables
satisfy this constraint within the specified tolerance amount. This method must work
regardless of whether the constraint has been added to a ConstraintSolver or not.
If the constraint has not been initialized, behaviour is undefined.
tolerance - Tolerance amount for checking constraint satisfaction.public java.util.Set getConstraintVariables()
public void setWeight(double weight)
weight - Weight value.public double getWeight()
|
CIDER Toolkit Version 0.1.0-beta |
|||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||