public class BinaryArithmetic extends BinaryConstraint
Modifier and Type | Field and Description |
---|---|
protected int |
cste
Optional constant value to allow more comparison for the constraint
|
private acqConstraints.Operator |
op1
Operator(s) used into this constraint.
|
private acqConstraints.Operator |
op2
Operator(s) used into this constraint.
|
Constructor and Description |
---|
BinaryArithmetic(java.lang.String name,
int var1,
acqConstraints.Operator op,
int var2)
Constructor for a constraint between two variables.
|
BinaryArithmetic(java.lang.String name,
int var1,
acqConstraints.Operator op1,
int var2,
acqConstraints.Operator op2,
int cste)
Constructor for a constraint involving two variables and a constant value
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
check(int value1,
int value2)
Checks this constraint for a specified set of values
|
BinaryArithmetic |
getNegation()
Returns a new BinaryArithmetic constraint which is the negation of this constraint
By instance, a constraint with "=" as operator will return a new constraint with the
same variables but with "!=" as operator
|
private boolean |
hasOperation()
Checks if this constraint has two operators
|
private static boolean |
isOperation(acqConstraints.Operator operator)
Checks if the specified operator is an operation operator
|
void |
toChoco(org.chocosolver.solver.Model model,
org.chocosolver.solver.variables.IntVar... intVars)
Add this constraint to the specified model (a choco solver model in this case)
|
check
checker, getArity, getName, getProjection, getScope, getVariables, toString
private final acqConstraints.Operator op1
private final acqConstraints.Operator op2
protected final int cste
public BinaryArithmetic(java.lang.String name, int var1, acqConstraints.Operator op, int var2)
name
- Name of this constraintvar1
- Variable of this constraintop
- Operator of this constraintvar2
- Variable of this constraintpublic BinaryArithmetic(java.lang.String name, int var1, acqConstraints.Operator op1, int var2, acqConstraints.Operator op2, int cste)
name
- Name of this constraintvar1
- Variable of this constraintop1
- Operator of this constraintvar2
- Variable of this constraintop2
- Operator of this constraintcste
- Constant value for this constraintprivate boolean hasOperation()
public BinaryArithmetic getNegation()
public void toChoco(org.chocosolver.solver.Model model, org.chocosolver.solver.variables.IntVar... intVars)
model
- Model to add this constraint tointVars
- Variables of the model involved in this constraintprotected boolean check(int value1, int value2)
check
in class BinaryConstraint
value1
- Value of the first variable of this constraintvalue2
- Value of the second variable of this constraintprivate static boolean isOperation(acqConstraints.Operator operator)
operator
- Operator to verify