blob: 495a53dd4334c929a68f6b2d3abe630fb7a0c062 (
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
|
package tools.refinery.language.semantics.model.internal;
import tools.refinery.store.representation.TruthValue;
public enum DecisionTreeValue {
UNSET(null),
TRUE(TruthValue.TRUE),
FALSE(TruthValue.FALSE),
UNKNOWN(TruthValue.UNKNOWN),
ERROR(TruthValue.ERROR);
final TruthValue truthValue;
DecisionTreeValue(TruthValue truthValue) {
this.truthValue = truthValue;
}
public TruthValue getTruthValue() {
return truthValue;
}
public TruthValue merge(TruthValue other) {
return truthValue == null ? other : truthValue.merge(other);
}
public DecisionTreeValue overwrite(DecisionTreeValue other) {
return other == UNSET ? this : other;
}
public TruthValue getTruthValueOrElse(TruthValue other) {
return this == UNSET ? other : truthValue;
}
public static DecisionTreeValue fromTruthValue(TruthValue truthValue) {
if (truthValue == null) {
return DecisionTreeValue.UNSET;
}
return switch (truthValue) {
case TRUE -> TRUE;
case FALSE -> FALSE;
case UNKNOWN -> UNKNOWN;
case ERROR -> ERROR;
};
}
}
|