int[][] values = DomainBuilder.buildFullDomains(2, 0, 15, r, d, false);
IntVar x = VariableFactory.enumerated("x", values[0], s);
IntVar y = VariableFactory.enumerated("y", values[1], s);
IntVar[] vars = new IntVar[]{b, x, y};
Constraint cons = IntConstraintFactory.arithm(x, "!=", y);
Constraint oppCons = IntConstraintFactory.arithm(x, "=", y);
Constraint cstr = LogicalConstraintFactory.ifThenElse(b, cons, oppCons);
s.post(cstr);
s.set(IntStrategyFactory.lexico_LB(vars));
s.findAllSolutions();
long sol = s.getMeasures().getSolutionCount();