Package org.projog.clp
Interface Constraint
-
- All Superinterfaces:
Expression
- All Known Subinterfaces:
LeafExpression
- All Known Implementing Classes:
And,Between,EqualTo,Equivalent,FixedValue,Implication,LessThan,LessThanOrEqualTo,Nand,Nor,Not,NotEqualTo,Or,Variable,Xor
public interface Constraint extends Expression
A rule that restricts the numeric values that can be used to solve a problem.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ConstraintResultenforce(ConstraintStore constraintStore)Attempts to enforce this constraint using the givenConstraintStore.default longgetMax(ReadConstraintStore constraintStore)default longgetMin(ReadConstraintStore constraintStore)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.default ExpressionResultsetMax(ConstraintStore constraintStore, long max)default ExpressionResultsetMin(ConstraintStore constraintStore, long min)voidwalk(java.util.function.Consumer<Expression> consumer)Traverse this constraint.-
Methods inherited from interface org.projog.clp.Expression
setNot
-
-
-
-
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.- Specified by:
walkin interfaceExpression- 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.- Specified by:
replacein interfaceExpression- 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.
-
getMin
default long getMin(ReadConstraintStore constraintStore)
- Specified by:
getMinin interfaceExpression
-
getMax
default long getMax(ReadConstraintStore constraintStore)
- Specified by:
getMaxin interfaceExpression
-
setMin
default ExpressionResult setMin(ConstraintStore constraintStore, long min)
- Specified by:
setMinin interfaceExpression
-
setMax
default ExpressionResult setMax(ConstraintStore constraintStore, long max)
- Specified by:
setMaxin interfaceExpression
-
-