Package org.projog.clp.math
Class Divide
- java.lang.Object
-
- org.projog.clp.math.Divide
-
- All Implemented Interfaces:
Expression
public final class Divide extends java.lang.Object implements Expression
The result of dividing oneExpressionby another.
-
-
Field Summary
Fields Modifier and Type Field Description private ExpressionleftThe dividend.private ExpressionrightThe divisor.
-
Constructor Summary
Constructors Constructor Description Divide(Expression left, Expression right)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static longcalcLeftMax(long right, long target)private static longcalcRightMax(long left, long target)private static longcalcRightMin(long left, long target)longgetMax(ReadConstraintStore s)longgetMin(ReadConstraintStore s)Dividereplace(java.util.function.Function<LeafExpression,LeafExpression> r)Returns aExpressionwithLeafExpressions in thisExpressionreplaced with values returned from the given function.ExpressionResultsetMax(ConstraintStore s, long max)ExpressionResultsetMin(ConstraintStore s, long min)java.lang.StringtoString()voidwalk(java.util.function.Consumer<Expression> r)Traverse this expression.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.projog.clp.Expression
setNot
-
-
-
-
Field Detail
-
left
private final Expression left
The dividend. What is being divided.
-
right
private final Expression right
The divisor. What the divided is being divided by.
-
-
Constructor Detail
-
Divide
public Divide(Expression left, Expression right)
-
-
Method Detail
-
getMin
public long getMin(ReadConstraintStore s)
- Specified by:
getMinin interfaceExpression
-
getMax
public long getMax(ReadConstraintStore s)
- Specified by:
getMaxin interfaceExpression
-
setMin
public ExpressionResult setMin(ConstraintStore s, long min)
- Specified by:
setMinin interfaceExpression
-
setMax
public ExpressionResult setMax(ConstraintStore s, long max)
- Specified by:
setMaxin interfaceExpression
-
calcLeftMax
private static long calcLeftMax(long right, long target)
-
calcRightMin
private static long calcRightMin(long left, long target)
-
calcRightMax
private static long calcRightMax(long left, long target)
-
walk
public void walk(java.util.function.Consumer<Expression> r)
Description copied from interface:ExpressionTraverse this expression.If this expression is a composite then all its sub-expressions will be traversed.
- Specified by:
walkin interfaceExpression- Parameters:
r- will be called for eachExpressioncontained within thisExpression.
-
replace
public Divide replace(java.util.function.Function<LeafExpression,LeafExpression> r)
Description copied from interface:ExpressionReturns aExpressionwithLeafExpressions in thisExpressionreplaced with values returned from the given function.- Specified by:
replacein interfaceExpression- Parameters:
r- 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.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-