Package org.projog.clp
Class FixedValue
- java.lang.Object
-
- org.projog.clp.FixedValue
-
- All Implemented Interfaces:
Constraint,Expression,LeafExpression
public final class FixedValue extends java.lang.Object implements LeafExpression
Represents a single immutable number.
-
-
Constructor Summary
Constructors Constructor Description FixedValue(long value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConstraintResultenforce(ConstraintStore constraintStore)Attempts to enforce this constraint using the givenConstraintStore.longgetMax(ReadConstraintStore s)longgetMin(ReadConstraintStore s)ConstraintResultprevent(ConstraintStore constraintStore)Attempts to prevent this constraint using the givenConstraintStore.ConstraintResultreify(ReadConstraintStore constraintStore)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)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
-
value
private final long value
-
-
Method Detail
-
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
-
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 constraintStore)
Description copied from interface:ConstraintAttempts to enforce this constraint using the givenConstraintStore.- Specified by:
enforcein interfaceConstraint
-
prevent
public ConstraintResult prevent(ConstraintStore constraintStore)
Description copied from interface:ConstraintAttempts to prevent this constraint using the givenConstraintStore.- Specified by:
preventin interfaceConstraint
-
reify
public ConstraintResult reify(ReadConstraintStore constraintStore)
- 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
-
-