diff options
Diffstat (limited to 'subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalDnfCallLiteral.java')
-rw-r--r-- | subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalDnfCallLiteral.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalDnfCallLiteral.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalDnfCallLiteral.java new file mode 100644 index 00000000..a49e0625 --- /dev/null +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalDnfCallLiteral.java | |||
@@ -0,0 +1,37 @@ | |||
1 | package tools.refinery.store.partial.literal; | ||
2 | |||
3 | import tools.refinery.store.query.Dnf; | ||
4 | import tools.refinery.store.query.Variable; | ||
5 | import tools.refinery.store.query.literal.CallPolarity; | ||
6 | import tools.refinery.store.query.literal.DnfCallLiteral; | ||
7 | import tools.refinery.store.query.literal.LiteralReduction; | ||
8 | import tools.refinery.store.query.literal.PolarLiteral; | ||
9 | |||
10 | import java.util.List; | ||
11 | import java.util.Map; | ||
12 | |||
13 | public class ModalDnfCallLiteral extends ModalLiteral<Dnf> implements PolarLiteral<ModalDnfCallLiteral> { | ||
14 | public ModalDnfCallLiteral(CallPolarity polarity, Modality modality, Dnf target, List<Variable> arguments) { | ||
15 | super(polarity, modality, target, arguments); | ||
16 | } | ||
17 | |||
18 | public ModalDnfCallLiteral(Modality modality, DnfCallLiteral baseLiteral) { | ||
19 | super(modality.commute(baseLiteral.getPolarity()), baseLiteral); | ||
20 | } | ||
21 | |||
22 | @Override | ||
23 | public ModalDnfCallLiteral substitute(Map<Variable, Variable> substitution) { | ||
24 | return new ModalDnfCallLiteral(getPolarity(), getModality(), getTarget(), substituteArguments(substitution)); | ||
25 | } | ||
26 | |||
27 | @Override | ||
28 | public ModalDnfCallLiteral negate() { | ||
29 | return new ModalDnfCallLiteral(getPolarity().negate(), getModality(), getTarget(), getArguments()); | ||
30 | } | ||
31 | |||
32 | @Override | ||
33 | public LiteralReduction getReduction() { | ||
34 | var dnfReduction = getTarget().getReduction(); | ||
35 | return getPolarity().isPositive() ? dnfReduction : dnfReduction.negate(); | ||
36 | } | ||
37 | } | ||