|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object hu.birot.OTKit.otBuildingBlocks.Constraint
public abstract class Constraint
Realizes a constraint.
A Constraint combines two pieces of information:
Hence, to construct a Constraint, one must specify its name in the constructor, as well as specify method Constraint.value(Candidate). Class ConstraintExamples contain a number of predifined constraints.
Constructor Summary | |
---|---|
Constraint(java.lang.String Name)
To construct a constraint, you must define its name, besides specifying method Constraint.value(Candidate). |
|
Constraint(java.lang.String Name,
java.lang.String Description)
To construct a constraint, you may define its name and its description, besides specifying method Constraint.value(Candidate). |
Method Summary | |
---|---|
java.lang.String |
description()
Description of the constraint. |
static Constraint |
empty(java.lang.String name)
Returning an "empty" Constraint, having only a name. |
boolean |
equals(java.lang.Object constr)
Two constraints are equals iff their name are equal. |
int |
hashCode()
Returns a hash code for this constraint. |
java.lang.String |
name()
This method returns the name of the constraint. |
void |
rename(java.lang.String newname)
Rename the constraint. |
void |
setDescription(java.lang.String Description)
Set the description of the constraint. |
java.lang.String |
toString()
The string corresponding to a constraint is its name. |
abstract Violation |
value(Candidate can)
The violation level assigned by the constraint to candidate can. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Constraint(java.lang.String Name)
public Constraint(java.lang.String Name, java.lang.String Description)
Method Detail |
---|
public abstract Violation value(Candidate can)
can
- : The candidate being evaluated.
public java.lang.String name()
public void rename(java.lang.String newname)
newname
- New name of the constraint.public java.lang.String description()
public void setDescription(java.lang.String Description)
public boolean equals(java.lang.Object constr)
equals
in class java.lang.Object
public int hashCode()
Returns a hash code for this constraint. The output is the hash code for the string containing the name of the constraint.
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static Constraint empty(java.lang.String name)
Returning an "empty" Constraint, having only a name. Its value method throws an exception. This method can be used if, for technical reasons, you need a constraint that has a name, but otherwise is never used.
name
- String containing the name of the returned Constraint.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |