Package generic.constraint
Class Constraint<T>
- java.lang.Object
-
- generic.constraint.Constraint<T>
-
- Type Parameters:
T
- The type of object that decisions will be made.
- Direct Known Subclasses:
ProgramConstraint
public abstract class Constraint<T> extends java.lang.Object
Constraints are used to make decisions to traverse a decision tree where each node in the tree has a constraint that is used to decide if that node is part of the successful decision path.
-
-
Constructor Summary
Constructors Constructor Description Constraint(java.lang.String name)
Constructor takes the name of the constraint.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
equals(java.lang.Object obj)
abstract java.lang.String
getDescription()
Returns a description of this constraint (with its configuration data) to be used to journal the decision path that was taken.java.lang.String
getName()
Returns the name of the constraint.abstract boolean
isSatisfied(T t)
Returns true if the given object satisfies this constraint.abstract void
loadConstraintData(ConstraintData data)
Initialized this constraint state.
-
-
-
Method Detail
-
getName
public final java.lang.String getName()
Returns the name of the constraint. Note: this name is also the XML tag used in the constraints specification files.- Returns:
- the name of the constraint
-
isSatisfied
public abstract boolean isSatisfied(T t)
Returns true if the given object satisfies this constraint.- Parameters:
the
- object to test this constraint on.- Returns:
- true if the given object satisfies this constraint.
-
loadConstraintData
public abstract void loadConstraintData(ConstraintData data)
Initialized this constraint state. Attributes in the xml element with this constaints tag name will be extracted into the ConstraintData object for easy retrieval.- Parameters:
data
- the ConstraintData object used to initialize this constraint.
-
equals
public abstract boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
getDescription
public abstract java.lang.String getDescription()
Returns a description of this constraint (with its configuration data) to be used to journal the decision path that was taken.- Returns:
- a description of this constraint with its configuration data.
-
-