aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/store
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-09-22 22:40:33 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2022-10-03 20:06:52 +0200
commitdb03801ae5eaa67f8c150413f483905184f5bdaa (patch)
treede96e12fc7d7f4006949ecaf0af535e3e5f1f59d /subprojects/store
parentchore(deps): bump dependencies (diff)
downloadrefinery-db03801ae5eaa67f8c150413f483905184f5bdaa.tar.gz
refinery-db03801ae5eaa67f8c150413f483905184f5bdaa.tar.zst
refinery-db03801ae5eaa67f8c150413f483905184f5bdaa.zip
feat: data structure for assertion merging
Diffstat (limited to 'subprojects/store')
-rw-r--r--subprojects/store/src/main/java/tools/refinery/store/model/representation/TruthValue.java23
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}