Package org.projog.clp
Interface Constraint
-
- All Known Subinterfaces:
LeafExpression
- All Known Implementing Classes:
And,Between,EqualTo,Equivalent,FixedValue,Implication,LessThan,LessThanOrEqualTo,Not,NotEqualTo,Or,Variable,Xor
public interface ConstraintA rule that restricts the numeric values that can be used to solve a problem.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ConstraintResultenforce(ConstraintStore constraintStore)Attempts to enforce this constraint using the givenConstraintStore.ConstraintResultprevent(ConstraintStore constraintStore)Attempts to prevent this constraint using the givenConstraintStore.ConstraintResultreify(ReadConstraintStore constraintStore)Constraintreplace(java.util.function.Function<LeafExpression,LeafExpression> function)Returns newConstraintwithLeafExpressions in thisConstraintreplaced with values returned from the given function.voidwalk(java.util.function.Consumer<Expression> consumer)Traverse this constraint.
-
-
-
Method Detail
-
enforce
ConstraintResult enforce(ConstraintStore constraintStore)
Attempts to enforce this constraint using the givenConstraintStore.
-
prevent
ConstraintResult prevent(ConstraintStore constraintStore)
Attempts to prevent this constraint using the givenConstraintStore.
-
reify
ConstraintResult reify(ReadConstraintStore constraintStore)
-
walk
void walk(java.util.function.Consumer<Expression> consumer)
Traverse this constraint.- Parameters:
consumer- will be called for eachExpressioncontained within thisConstraint.
-
replace
Constraint replace(java.util.function.Function<LeafExpression,LeafExpression> function)
Returns newConstraintwithLeafExpressions in thisConstraintreplaced with values returned from the given function.- Parameters:
function- returns theLeafExpressionto use as a replacement for theLeafExpressionit is called with, ornullif the originalLeafExpressionshould continue to be used.- Returns:
- a new
ConstraintwithLeafExpressions in thisConstraintreplaced with versions returned fromfunction.
-
-