Package org.projog.clp
Interface Expression
-
- All Known Subinterfaces:
Constraint,LeafExpression
- All Known Implementing Classes:
Absolute,Add,And,Between,Divide,EqualTo,Equivalent,FixedValue,Implication,LessThan,LessThanOrEqualTo,Maximum,Minimum,Minus,Multiply,Nand,Nor,Not,NotEqualTo,Or,Subtract,Variable,Xor
public interface ExpressionRepresents something that can have a range of numeric values.Could be a single immutable value (see
FixedValue), a variable that can have one or more possible values (seeVariable) or a composite that contains otherExpressionobjects (e.g.Add).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description longgetMax(ReadConstraintStore constraintStore)longgetMin(ReadConstraintStore constraintStore)Expressionreplace(java.util.function.Function<LeafExpression,LeafExpression> function)Returns aExpressionwithLeafExpressions in thisExpressionreplaced with values returned from the given function.ExpressionResultsetMax(ConstraintStore constraintStore, long max)ExpressionResultsetMin(ConstraintStore constraintStore, long min)default ExpressionResultsetNot(ConstraintStore store, long not)voidwalk(java.util.function.Consumer<Expression> consumer)Traverse this expression.
-
-
-
Method Detail
-
getMin
long getMin(ReadConstraintStore constraintStore)
-
getMax
long getMax(ReadConstraintStore constraintStore)
-
setNot
default ExpressionResult setNot(ConstraintStore store, long not)
-
setMin
ExpressionResult setMin(ConstraintStore constraintStore, long min)
-
setMax
ExpressionResult setMax(ConstraintStore constraintStore, long max)
-
walk
void walk(java.util.function.Consumer<Expression> consumer)
Traverse this expression.If this expression is a composite then all its sub-expressions will be traversed.
- Parameters:
consumer- will be called for eachExpressioncontained within thisExpression.
-
replace
Expression replace(java.util.function.Function<LeafExpression,LeafExpression> function)
Returns aExpressionwithLeafExpressions in thisExpressionreplaced 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
ExpressionwithLeafExpressions in thisExpressionreplaced with versions returned fromfunction.
-
-