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 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 Details

    • Constraint

      public Constraint(String name)
      Constructor takes the name of the constraint. This name will be tag used in the XML specification file.
      Parameters:
      name - the name of the constraint
  • Method Details

    • getName

      public final 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:
      t - 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(Object obj)
      Overrides:
      equals in class Object
    • getDescription

      public abstract 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.