v2.4.0
What's new
Typed generics throughout the constraint hierarchy
`Variable<T>` is now a phantom type carrying the value type at compile time. This propagates through the entire API so the compiler enforces consistency between variables, domains, and constraints.
CSP builder methods are now type-safe:
Variable<Integer> x = Variable.Factory.INSTANCE.create("x");
csp.variableDomain(x, IntRangeDomain.of(0, 9)) // Domain<Integer> required
.equalsConstraint(x, "wrong") // compile error — String ≠ Integer
.notEqualsConstraint(x, 0) // ok
.atMostOneConstraint(Set.of(boolVar)) // Set<Variable<Boolean>> requiredAssignment.getValue returns typed Optional:
Optional<Integer> v = assignment.getValue(intVar); // no cast neededgetDomain / findDomain return typed Domain:
Domain<Integer> d = csp.getDomain(intVar); // no cast neededOther changes since v2.3.0
- `UnaryConstraint<T>` and `BinaryConstraint<L,R>` — `isSatisfiedBy` no longer requires unchecked casts
- `Domain<T>` propagated throughout domains and consistency algorithms
- `UniformNaryConstraint<T>` for same-type n-ary constraints (`AllDiffConstraint<T>`, `AtMostOneConstraint`)
- Timetabling test improvements: room specialisation, teacher unavailability, session frequency