|
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 compiler allows solver constraint strings to constraint expression strings to be parsed during a compile phase, so they will not need to be parsed during the runtime of the application that uses them. This interface defines how a constraint compiler is used. Classes that implement this interface should also define a no-argument constructor.
| Method Summary | |
void |
createConstraintClass(java.lang.String className,
java.lang.String classPackage,
java.lang.String constraintStr,
java.io.PrintWriter output)
Creates a constraint class. |
void |
createConstraintExpressionClass(java.lang.String className,
java.lang.String classPackage,
java.lang.String expressionStr,
java.io.PrintWriter output)
Creates a constraint expression class. |
| Method Detail |
public void createConstraintClass(java.lang.String className,
java.lang.String classPackage,
java.lang.String constraintStr,
java.io.PrintWriter output)
throws CannotProcessConstraintException,
java.lang.NumberFormatException
classPackage is the empty string),
then the import statements that are needed, and then the class itself. The class should implement the Constraint
interface, or extend another class that already implements this interface.
Inside the class, only the constructor needs to be created. This constructor receives one argument, an array of
ConstraintVariables, and also throws an java.lang.ArrayIndexOutOfBoundsException (which is thrown if an illegal
access to the array is attempted). Essentially, the constructor works the same as the Constraint.initialize(java.lang.String, au.edu.monash.csse.tonyj.cider.constraints.ConstraintVariable[]) method, except the
constructor will be able to create the constraint directly without having to parse a string.
className - The name of the constraint class.classPackage - The name of the package the constraint class belongs to.constraintStr - A string that defines the constraint (this string needs to be parsed).output - The output stream where the class is to be written.
CannotProcessConstraintException - If string cannot be parsed.
java.lang.NumberFormatException - If an illegal number format is found in the string being parsed.
public void createConstraintExpressionClass(java.lang.String className,
java.lang.String classPackage,
java.lang.String expressionStr,
java.io.PrintWriter output)
throws CannotProcessConstraintException,
java.lang.NumberFormatException
classPackage is the empty string),
then the import statements that are needed, and then the class itself. The class should implement the
ConstraintExpression interface, or extend another class that already implements this interface.
Inside the class, only the constructor needs to be created. This constructor receives one argument, an array of
ConstraintVariables, and also throws an java.lang.ArrayIndexOutOfBoundsException (which is thrown if an illegal
access to the array is attempted). Essentially, the constructor works the same as the ConstraintExpression.initialize(java.lang.String, au.edu.monash.csse.tonyj.cider.constraints.ConstraintVariable[]) method,
except the constructor will be able to create the constraint directly without having to parse a string.
className - The name of the constraint expression class.classPackage - The name of the package the constraint expression class belongs to.expressionStr - A string that defines the constraint expression (this string needs to be parsed).output - The output stream where the class is to be written.
CannotProcessConstraintException - If string cannot be parsed.
java.lang.NumberFormatException - If an illegal number format is found in the string being parsed.
|
CIDER Toolkit Version 0.1.0-beta |
|||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||