blob: c3bc3ea30b21e526006a50e417e7cdeffca4396d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package tools.refinery.store.query.equality;
import tools.refinery.store.query.dnf.Dnf;
import tools.refinery.store.util.CycleDetectingMapper;
import java.util.List;
public class DeepDnfEqualityChecker implements DnfEqualityChecker {
private final CycleDetectingMapper<Pair, Boolean> mapper = new CycleDetectingMapper<>(Pair::toString,
this::doCheckEqual);
@Override
public boolean dnfEqual(Dnf left, Dnf right) {
return mapper.map(new Pair(left, right));
}
protected boolean doCheckEqual(Pair pair) {
return pair.left.equalsWithSubstitution(this, pair.right);
}
protected List<Pair> getInProgress() {
return mapper.getInProgress();
}
protected record Pair(Dnf left, Dnf right) {
@Override
public String toString() {
return "(%s, %s)".formatted(left.name(), right.name());
}
}
}
|