blob: 63a817139823e65638a1213a77d783c85dd853da (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
package tools.refinery.store.query;
import java.util.HashSet;
import java.util.Set;
public record FunctionalDependency<T>(Set<T> forEach, Set<T> unique) {
public FunctionalDependency {
var uniqueForEach = new HashSet<>(unique);
uniqueForEach.retainAll(forEach);
if (!uniqueForEach.isEmpty()) {
throw new IllegalArgumentException("Variables %s appear on both sides of the functional dependency"
.formatted(uniqueForEach));
}
}
}
|