Package org.projog.clp
Class Variable
- java.lang.Object
-
- org.projog.clp.Variable
-
- All Implemented Interfaces:
Constraint,Expression,LeafExpression
public final class Variable extends java.lang.Object implements LeafExpression
An expression that can have one or more possible numeric values.
-
-
Constructor Summary
Constructors Constructor Description Variable(int id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConstraintResultenforce(ConstraintStore s)Attempts to enforce this constraint using the givenConstraintStore.(package private) intgetId()longgetMax(ReadConstraintStore s)longgetMin(ReadConstraintStore s)ConstraintResultprevent(ConstraintStore s)Attempts to prevent this constraint using the givenConstraintStore.ConstraintResultreify(ReadConstraintStore s)LeafExpressionreplace(java.util.function.Function<LeafExpression,LeafExpression> function)Returns newConstraintwithLeafExpressions in thisConstraintreplaced with values returned from the given function.ExpressionResultsetMax(ConstraintStore s, long max)ExpressionResultsetMin(ConstraintStore s, long min)ExpressionResultsetNot(ConstraintStore s, long not)ExpressionResultsetValue(ConstraintStore s, long value)java.lang.StringtoString()voidwalk(java.util.function.Consumer<Expression> r)Traverse this constraint.
-
-
-
Field Detail
-
TRUE
private static final int TRUE
- See Also:
- Constant Field Values
-
FALSE
private static final int FALSE
- See Also:
- Constant Field Values
-
id
private final int id
-
-
Method Detail
-
getId
int getId()
-
getMin
public long getMin(ReadConstraintStore s)
- Specified by:
getMinin interfaceConstraint- Specified by:
getMinin interfaceExpression
-
getMax
public long getMax(ReadConstraintStore s)
- Specified by:
getMaxin interfaceConstraint- Specified by:
getMaxin interfaceExpression
-
setValue
public ExpressionResult setValue(ConstraintStore s, long value)
-
setNot
public ExpressionResult setNot(ConstraintStore s, long not)
- Specified by:
setNotin interfaceExpression
-
setMin
public ExpressionResult setMin(ConstraintStore s, long min)
- Specified by:
setMinin interfaceConstraint- Specified by:
setMinin interfaceExpression
-
setMax
public ExpressionResult setMax(ConstraintStore s, long max)
- Specified by:
setMaxin interfaceConstraint- Specified by:
setMaxin interfaceExpression
-
enforce
public ConstraintResult enforce(ConstraintStore s)
Description copied from interface:ConstraintAttempts to enforce this constraint using the givenConstraintStore.- Specified by:
enforcein interfaceConstraint
-
prevent
public ConstraintResult prevent(ConstraintStore s)
Description copied from interface:ConstraintAttempts to prevent this constraint using the givenConstraintStore.- Specified by:
preventin interfaceConstraint
-
reify
public ConstraintResult reify(ReadConstraintStore s)
- Specified by:
reifyin interfaceConstraint
-
walk
public void walk(java.util.function.Consumer<Expression> r)
Description copied from interface:ConstraintTraverse this constraint.- Specified by:
walkin interfaceConstraint- Specified by:
walkin interfaceExpression- Parameters:
r- will be called for eachExpressioncontained within thisConstraint.
-
replace
public LeafExpression replace(java.util.function.Function<LeafExpression,LeafExpression> function)
Description copied from interface:ConstraintReturns newConstraintwithLeafExpressions in thisConstraintreplaced with values returned from the given function.- Specified by:
replacein interfaceConstraint- Specified by:
replacein interfaceExpression- Specified by:
replacein interfaceLeafExpression- 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.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-