blob: 1bf3c8b82e8d0d0591aff9541352a5af9c4498bf (
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
|
package tools.refinery.language.semantics.model.internal;
import tools.refinery.store.model.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 DecisionTreeValue merge(TruthValue other) {
return truthValue == null ? fromTruthValue(other) : fromTruthValue(truthValue.merge(other));
}
public DecisionTreeValue overwrite(DecisionTreeValue other) {
return other == UNSET ? this : other;
}
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;
};
}
}
|