diff options
Diffstat (limited to 'subprojects/store/src')
-rw-r--r-- | subprojects/store/src/main/java/tools/refinery/store/model/representation/TruthValue.java | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/subprojects/store/src/main/java/tools/refinery/store/model/representation/TruthValue.java b/subprojects/store/src/main/java/tools/refinery/store/model/representation/TruthValue.java index 610713f3..a5ba825b 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/model/representation/TruthValue.java +++ b/subprojects/store/src/main/java/tools/refinery/store/model/representation/TruthValue.java | |||
@@ -11,7 +11,7 @@ public enum TruthValue { | |||
11 | 11 | ||
12 | private final String name; | 12 | private final String name; |
13 | 13 | ||
14 | private TruthValue(String name) { | 14 | TruthValue(String name) { |
15 | this.name = name; | 15 | this.name = name; |
16 | } | 16 | } |
17 | 17 | ||
@@ -40,12 +40,19 @@ public enum TruthValue { | |||
40 | } | 40 | } |
41 | 41 | ||
42 | public TruthValue not() { | 42 | public TruthValue not() { |
43 | if (this == TRUE) { | 43 | return switch (this) { |
44 | return FALSE; | 44 | case TRUE -> FALSE; |
45 | } else if (this == FALSE) { | 45 | case FALSE -> TRUE; |
46 | return TRUE; | 46 | default -> this; |
47 | } else { | 47 | }; |
48 | return this; | 48 | } |
49 | } | 49 | |
50 | public TruthValue merge(TruthValue other) { | ||
51 | return switch (this) { | ||
52 | case TRUE -> other == UNKNOWN || other == TRUE ? TRUE : ERROR; | ||
53 | case FALSE -> other == TruthValue.UNKNOWN || other == TruthValue.FALSE ? FALSE : ERROR; | ||
54 | case UNKNOWN -> other; | ||
55 | default -> ERROR; | ||
56 | }; | ||
50 | } | 57 | } |
51 | } | 58 | } |