aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/store-partial/src/main/java/tools
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/store-partial/src/main/java/tools')
-rw-r--r--subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalDnfCallLiteral.java15
-rw-r--r--subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalLiteral.java18
-rw-r--r--subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalRelationLiteral.java10
-rw-r--r--subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/PartialRelationLiteral.java9
4 files changed, 46 insertions, 6 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
index a49e0625..8c157187 100644
--- 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
@@ -2,13 +2,14 @@ package tools.refinery.store.partial.literal;
2 2
3import tools.refinery.store.query.Dnf; 3import tools.refinery.store.query.Dnf;
4import tools.refinery.store.query.Variable; 4import tools.refinery.store.query.Variable;
5import tools.refinery.store.query.equality.LiteralEqualityHelper;
5import tools.refinery.store.query.literal.CallPolarity; 6import tools.refinery.store.query.literal.CallPolarity;
6import tools.refinery.store.query.literal.DnfCallLiteral; 7import tools.refinery.store.query.literal.DnfCallLiteral;
7import tools.refinery.store.query.literal.LiteralReduction; 8import tools.refinery.store.query.literal.LiteralReduction;
8import tools.refinery.store.query.literal.PolarLiteral; 9import tools.refinery.store.query.literal.PolarLiteral;
10import tools.refinery.store.query.substitution.Substitution;
9 11
10import java.util.List; 12import java.util.List;
11import java.util.Map;
12 13
13public class ModalDnfCallLiteral extends ModalLiteral<Dnf> implements PolarLiteral<ModalDnfCallLiteral> { 14public class ModalDnfCallLiteral extends ModalLiteral<Dnf> implements PolarLiteral<ModalDnfCallLiteral> {
14 public ModalDnfCallLiteral(CallPolarity polarity, Modality modality, Dnf target, List<Variable> arguments) { 15 public ModalDnfCallLiteral(CallPolarity polarity, Modality modality, Dnf target, List<Variable> arguments) {
@@ -20,7 +21,17 @@ public class ModalDnfCallLiteral extends ModalLiteral<Dnf> implements PolarLiter
20 } 21 }
21 22
22 @Override 23 @Override
23 public ModalDnfCallLiteral substitute(Map<Variable, Variable> substitution) { 24 public Class<Dnf> getTargetType() {
25 return Dnf.class;
26 }
27
28 @Override
29 protected boolean targetEquals(LiteralEqualityHelper helper, Dnf otherTarget) {
30 return helper.dnfEqual(getTarget(), otherTarget);
31 }
32
33 @Override
34 public ModalDnfCallLiteral substitute(Substitution substitution) {
24 return new ModalDnfCallLiteral(getPolarity(), getModality(), getTarget(), substituteArguments(substitution)); 35 return new ModalDnfCallLiteral(getPolarity(), getModality(), getTarget(), substituteArguments(substitution));
25 } 36 }
26 37
diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalLiteral.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalLiteral.java
index a1b6c83e..cebe9c9d 100644
--- a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalLiteral.java
+++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalLiteral.java
@@ -2,8 +2,10 @@ package tools.refinery.store.partial.literal;
2 2
3import tools.refinery.store.query.RelationLike; 3import tools.refinery.store.query.RelationLike;
4import tools.refinery.store.query.Variable; 4import tools.refinery.store.query.Variable;
5import tools.refinery.store.query.equality.LiteralEqualityHelper;
5import tools.refinery.store.query.literal.CallLiteral; 6import tools.refinery.store.query.literal.CallLiteral;
6import tools.refinery.store.query.literal.CallPolarity; 7import tools.refinery.store.query.literal.CallPolarity;
8import tools.refinery.store.query.literal.Literal;
7 9
8import java.util.List; 10import java.util.List;
9import java.util.Objects; 11import java.util.Objects;
@@ -26,6 +28,22 @@ public abstract class ModalLiteral<T extends RelationLike> extends CallLiteral<T
26 } 28 }
27 29
28 @Override 30 @Override
31 public boolean equalsWithSubstitution(LiteralEqualityHelper helper, Literal other) {
32 if (!super.equalsWithSubstitution(helper, other)) {
33 return false;
34 }
35 // If {@link CallLiteral#equalsWithSubstitution(LiteralEqualityHelper, Literal)} has returned {@code true},
36 // we must have the same dynamic type as {@code other}.
37 var otherModalLiteral = (ModalLiteral<?>) other;
38 return modality == otherModalLiteral.modality;
39 }
40
41 @Override
42 protected String targetToString() {
43 return "%s %s".formatted(modality, super.targetToString());
44 }
45
46 @Override
29 public boolean equals(Object o) { 47 public boolean equals(Object o) {
30 if (this == o) return true; 48 if (this == o) return true;
31 if (o == null || getClass() != o.getClass()) return false; 49 if (o == null || getClass() != o.getClass()) return false;
diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalRelationLiteral.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalRelationLiteral.java
index dbaa524f..39054f22 100644
--- a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalRelationLiteral.java
+++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalRelationLiteral.java
@@ -4,9 +4,9 @@ import tools.refinery.store.partial.representation.PartialRelation;
4import tools.refinery.store.query.Variable; 4import tools.refinery.store.query.Variable;
5import tools.refinery.store.query.literal.CallPolarity; 5import tools.refinery.store.query.literal.CallPolarity;
6import tools.refinery.store.query.literal.PolarLiteral; 6import tools.refinery.store.query.literal.PolarLiteral;
7import tools.refinery.store.query.substitution.Substitution;
7 8
8import java.util.List; 9import java.util.List;
9import java.util.Map;
10 10
11public final class ModalRelationLiteral extends ModalLiteral<PartialRelation> 11public final class ModalRelationLiteral extends ModalLiteral<PartialRelation>
12 implements PolarLiteral<ModalRelationLiteral> { 12 implements PolarLiteral<ModalRelationLiteral> {
@@ -15,12 +15,18 @@ public final class ModalRelationLiteral extends ModalLiteral<PartialRelation>
15 super(polarity, modality, target, arguments); 15 super(polarity, modality, target, arguments);
16 } 16 }
17 17
18
18 public ModalRelationLiteral(Modality modality, PartialRelationLiteral baseLiteral) { 19 public ModalRelationLiteral(Modality modality, PartialRelationLiteral baseLiteral) {
19 super(modality, baseLiteral); 20 super(modality, baseLiteral);
20 } 21 }
21 22
22 @Override 23 @Override
23 public ModalRelationLiteral substitute(Map<Variable, Variable> substitution) { 24 public Class<PartialRelation> getTargetType() {
25 return PartialRelation.class;
26 }
27
28 @Override
29 public ModalRelationLiteral substitute(Substitution substitution) {
24 return new ModalRelationLiteral(getPolarity(), getModality(), getTarget(), substituteArguments(substitution)); 30 return new ModalRelationLiteral(getPolarity(), getModality(), getTarget(), substituteArguments(substitution));
25 } 31 }
26 32
diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/PartialRelationLiteral.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/PartialRelationLiteral.java
index dc1a1da3..b81d9a3d 100644
--- a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/PartialRelationLiteral.java
+++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/PartialRelationLiteral.java
@@ -5,9 +5,9 @@ import tools.refinery.store.query.Variable;
5import tools.refinery.store.query.literal.CallLiteral; 5import tools.refinery.store.query.literal.CallLiteral;
6import tools.refinery.store.query.literal.CallPolarity; 6import tools.refinery.store.query.literal.CallPolarity;
7import tools.refinery.store.query.literal.PolarLiteral; 7import tools.refinery.store.query.literal.PolarLiteral;
8import tools.refinery.store.query.substitution.Substitution;
8 9
9import java.util.List; 10import java.util.List;
10import java.util.Map;
11 11
12public final class PartialRelationLiteral extends CallLiteral<PartialRelation> 12public final class PartialRelationLiteral extends CallLiteral<PartialRelation>
13 implements PolarLiteral<PartialRelationLiteral> { 13 implements PolarLiteral<PartialRelationLiteral> {
@@ -16,7 +16,12 @@ public final class PartialRelationLiteral extends CallLiteral<PartialRelation>
16 } 16 }
17 17
18 @Override 18 @Override
19 public PartialRelationLiteral substitute(Map<Variable, Variable> substitution) { 19 public Class<PartialRelation> getTargetType() {
20 return PartialRelation.class;
21 }
22
23 @Override
24 public PartialRelationLiteral substitute(Substitution substitution) {
20 return new PartialRelationLiteral(getPolarity(), getTarget(), substituteArguments(substitution)); 25 return new PartialRelationLiteral(getPolarity(), getTarget(), substituteArguments(substitution));
21 } 26 }
22 27