javax.constraints.impl.constraint.IfThen Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsr331-sugar Show documentation
Show all versions of jsr331-sugar Show documentation
This is a JSR331 interface for the open source Java constraint programming library "Sugar" v. 2.1.3
The newest version!
package javax.constraints.impl.constraint;
import javax.constraints.impl.Problem;
import javax.constraints.impl.Constraint;
import jp.kobe_u.sugar.expression.Expression;
/**
* An implementation of the Constraint "IfThen"
*/
public class IfThen extends Constraint {
public IfThen(javax.constraints.Constraint c1, javax.constraints.Constraint c2) {
super(c1.getProblem(), "implies");
Problem p = (Problem)getProblem();
sugarImp(p.toExpr(c1), p.toExpr(c2));
}
private void sugarImp(Expression c1, Expression c2) {
Expression c = Expression.create(new Expression[] {
Expression.IMP,
c1,
c2
});
_setImpl(c);
}
}