CIDER Toolkit
Version 0.1.0-beta

au.edu.monash.csse.tonyj.cider.constraints
Interface ConstraintExpression

All Superinterfaces:
java.io.Serializable

public interface ConstraintExpression
extends java.io.Serializable

A constraint expression is a component of a Constraint. This interface defines how a constraint expression is manipulated. Classes that implement this interface should also define a no-argument constructor and must be Serializable.


Method Summary
 double evaluate()
          Evaluates this expression using the solved values of the constraint variables, and returns the resulting value.
 java.util.Set getConstraintVariables()
          Returns a set containing all the constraint variables used by this constraint expression.
 void initialize(java.lang.String expression, ConstraintVariable[] variables)
          Initializes the constraint expression from a string.
 

Method Detail

initialize

public void initialize(java.lang.String expression,
                       ConstraintVariable[] variables)
                throws CannotProcessConstraintException,
                       java.lang.ArrayIndexOutOfBoundsException,
                       java.lang.NumberFormatException
Initializes the constraint expression from a string.

Parameters:
expression - A string that defines the constraint expression (this string needs to be parsed).
variables - An array of constraint variables that the expression string refers to.
Throws:
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.

evaluate

public double evaluate()
Evaluates this expression using the solved values of the constraint variables, and returns the resulting value. If the constraint expression has not been initialized, behaviour is undefined.

Returns:
Value resulting from evaluation.

getConstraintVariables

public java.util.Set getConstraintVariables()
Returns a set containing all the constraint variables used by this constraint expression.


CIDER Toolkit
Version 0.1.0-beta