diff options
author | 2023-06-22 21:52:53 +0200 | |
---|---|---|
committer | 2023-06-22 22:03:13 +0200 | |
commit | f2ab0e12838efe5a23abb79fd7228f89dc3ba8ef (patch) | |
tree | a11fe1e4663563dfee094aae08fc03cbbab89839 /subprojects/store-reasoning/src | |
parent | refactor: remove Rule (diff) | |
download | refinery-f2ab0e12838efe5a23abb79fd7228f89dc3ba8ef.tar.gz refinery-f2ab0e12838efe5a23abb79fd7228f89dc3ba8ef.tar.zst refinery-f2ab0e12838efe5a23abb79fd7228f89dc3ba8ef.zip |
fix: FilteredView default value
The filer can't return true for the default value, because tuples with default
value cannot be enumerated.
Diffstat (limited to 'subprojects/store-reasoning/src')
2 files changed, 34 insertions, 2 deletions
diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredMayTypeView.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredMayTypeView.java index ce2d6ff3..40de4644 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredMayTypeView.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredMayTypeView.java | |||
@@ -9,6 +9,8 @@ import tools.refinery.store.reasoning.representation.PartialRelation; | |||
9 | import tools.refinery.store.query.view.TuplePreservingView; | 9 | import tools.refinery.store.query.view.TuplePreservingView; |
10 | import tools.refinery.store.tuple.Tuple; | 10 | import tools.refinery.store.tuple.Tuple; |
11 | 11 | ||
12 | import java.util.Objects; | ||
13 | |||
12 | class InferredMayTypeView extends TuplePreservingView<InferredType> { | 14 | class InferredMayTypeView extends TuplePreservingView<InferredType> { |
13 | private final PartialRelation type; | 15 | private final PartialRelation type; |
14 | 16 | ||
@@ -18,7 +20,21 @@ class InferredMayTypeView extends TuplePreservingView<InferredType> { | |||
18 | } | 20 | } |
19 | 21 | ||
20 | @Override | 22 | @Override |
21 | public boolean filter(Tuple key, InferredType value) { | 23 | protected boolean doFilter(Tuple key, InferredType value) { |
22 | return value.mayConcreteTypes().contains(type); | 24 | return value.mayConcreteTypes().contains(type); |
23 | } | 25 | } |
26 | |||
27 | @Override | ||
28 | public boolean equals(Object o) { | ||
29 | if (this == o) return true; | ||
30 | if (o == null || getClass() != o.getClass()) return false; | ||
31 | if (!super.equals(o)) return false; | ||
32 | InferredMayTypeView that = (InferredMayTypeView) o; | ||
33 | return Objects.equals(type, that.type); | ||
34 | } | ||
35 | |||
36 | @Override | ||
37 | public int hashCode() { | ||
38 | return Objects.hash(super.hashCode(), type); | ||
39 | } | ||
24 | } | 40 | } |
diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredMustTypeView.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredMustTypeView.java index beda1796..1a121547 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredMustTypeView.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/InferredMustTypeView.java | |||
@@ -9,6 +9,8 @@ import tools.refinery.store.reasoning.representation.PartialRelation; | |||
9 | import tools.refinery.store.query.view.TuplePreservingView; | 9 | import tools.refinery.store.query.view.TuplePreservingView; |
10 | import tools.refinery.store.tuple.Tuple; | 10 | import tools.refinery.store.tuple.Tuple; |
11 | 11 | ||
12 | import java.util.Objects; | ||
13 | |||
12 | class InferredMustTypeView extends TuplePreservingView<InferredType> { | 14 | class InferredMustTypeView extends TuplePreservingView<InferredType> { |
13 | private final PartialRelation type; | 15 | private final PartialRelation type; |
14 | 16 | ||
@@ -18,7 +20,21 @@ class InferredMustTypeView extends TuplePreservingView<InferredType> { | |||
18 | } | 20 | } |
19 | 21 | ||
20 | @Override | 22 | @Override |
21 | public boolean filter(Tuple key, InferredType value) { | 23 | protected boolean doFilter(Tuple key, InferredType value) { |
22 | return value.mustTypes().contains(type); | 24 | return value.mustTypes().contains(type); |
23 | } | 25 | } |
26 | |||
27 | @Override | ||
28 | public boolean equals(Object o) { | ||
29 | if (this == o) return true; | ||
30 | if (o == null || getClass() != o.getClass()) return false; | ||
31 | if (!super.equals(o)) return false; | ||
32 | InferredMustTypeView that = (InferredMustTypeView) o; | ||
33 | return Objects.equals(type, that.type); | ||
34 | } | ||
35 | |||
36 | @Override | ||
37 | public int hashCode() { | ||
38 | return Objects.hash(super.hashCode(), type); | ||
39 | } | ||
24 | } | 40 | } |