blob: 045b7147140a01fd8921257f2498453692a869c2 (
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
|
/*
* 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.logic.literal.CallPolarity;
import java.util.Locale;
public enum Modality {
MUST,
MAY;
public Modality negate() {
return switch(this) {
case MUST -> MAY;
case MAY -> MUST;
};
}
public Modality commute(CallPolarity polarity) {
if (polarity.isPositive()) {
return this;
}
return this.negate();
}
@Override
public String toString() {
return name().toLowerCase(Locale.ROOT);
}
}
|