blob: 4e5a60998450b1c369266b8ebdd6408e82c9c536 (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
/*
* SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
*
* SPDX-License-Identifier: EPL-2.0
*/
package tools.refinery.store.reasoning.literal;
import tools.refinery.store.query.Constraint;
import tools.refinery.store.query.equality.LiteralEqualityHelper;
import tools.refinery.store.query.literal.Reduction;
import tools.refinery.store.query.term.Parameter;
import java.util.List;
public record ModalConstraint(Modality modality, Constraint constraint) implements Constraint {
private static final String FORMAT = "%s %s";
@Override
public String name() {
return FORMAT.formatted(modality, constraint.name());
}
@Override
public List<Parameter> getParameters() {
return constraint.getParameters();
}
@Override
public Reduction getReduction() {
return constraint.getReduction();
}
@Override
public boolean equals(LiteralEqualityHelper helper, Constraint other) {
if (getClass() != other.getClass()) {
return false;
}
var otherModalConstraint = (ModalConstraint) other;
return modality == otherModalConstraint.modality && constraint.equals(helper, otherModalConstraint.constraint);
}
@Override
public String toReferenceString() {
return FORMAT.formatted(modality, constraint.toReferenceString());
}
@Override
public String toString() {
return FORMAT.formatted(modality, constraint);
}
}
|