aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningAdapterImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningAdapterImpl.java')
-rw-r--r--subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningAdapterImpl.java22
1 files changed, 12 insertions, 10 deletions
diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningAdapterImpl.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningAdapterImpl.java
index bd16bdfa..386ae1d8 100644
--- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningAdapterImpl.java
+++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningAdapterImpl.java
@@ -1,11 +1,12 @@
1/* 1/*
2 * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> 2 * SPDX-FileCopyrightText: 2021-2024 The Refinery Authors <https://refinery.tools/>
3 * 3 *
4 * SPDX-License-Identifier: EPL-2.0 4 * SPDX-License-Identifier: EPL-2.0
5 */ 5 */
6package tools.refinery.store.reasoning.internal; 6package tools.refinery.store.reasoning.internal;
7 7
8import org.jetbrains.annotations.Nullable; 8import org.jetbrains.annotations.Nullable;
9import tools.refinery.logic.AbstractValue;
9import tools.refinery.store.model.Interpretation; 10import tools.refinery.store.model.Interpretation;
10import tools.refinery.store.model.Model; 11import tools.refinery.store.model.Model;
11import tools.refinery.store.reasoning.ReasoningAdapter; 12import tools.refinery.store.reasoning.ReasoningAdapter;
@@ -19,8 +20,8 @@ import tools.refinery.store.reasoning.representation.AnyPartialSymbol;
19import tools.refinery.store.reasoning.representation.PartialSymbol; 20import tools.refinery.store.reasoning.representation.PartialSymbol;
20import tools.refinery.store.reasoning.translator.multiobject.MultiObjectTranslator; 21import tools.refinery.store.reasoning.translator.multiobject.MultiObjectTranslator;
21import tools.refinery.store.representation.Symbol; 22import tools.refinery.store.representation.Symbol;
22import tools.refinery.store.representation.cardinality.CardinalityInterval; 23import tools.refinery.logic.term.cardinalityinterval.CardinalityInterval;
23import tools.refinery.store.representation.cardinality.CardinalityIntervals; 24import tools.refinery.logic.term.cardinalityinterval.CardinalityIntervals;
24import tools.refinery.store.tuple.Tuple; 25import tools.refinery.store.tuple.Tuple;
25import tools.refinery.store.tuple.Tuple1; 26import tools.refinery.store.tuple.Tuple1;
26 27
@@ -49,7 +50,7 @@ class ReasoningAdapterImpl implements ReasoningAdapter {
49 createPartialInterpretations(); 50 createPartialInterpretations();
50 51
51 var refinerFactories = storeAdapter.getSymbolRefiners(); 52 var refinerFactories = storeAdapter.getSymbolRefiners();
52 refiners = new HashMap<>(refinerFactories.size()); 53 refiners = HashMap.newHashMap(refinerFactories.size());
53 createRefiners(); 54 createRefiners();
54 55
55 storageRefiners = storeAdapter.createStorageRefiner(model); 56 storageRefiners = storeAdapter.createStorageRefiner(model);
@@ -69,7 +70,7 @@ class ReasoningAdapterImpl implements ReasoningAdapter {
69 for (int i = 0; i < concretenessLength; i++) { 70 for (int i = 0; i < concretenessLength; i++) {
70 var concreteness = Concreteness.values()[i]; 71 var concreteness = Concreteness.values()[i];
71 if (supportedInterpretations.contains(concreteness)) { 72 if (supportedInterpretations.contains(concreteness)) {
72 partialInterpretations[i] = new HashMap<>(interpretationFactories.size()); 73 partialInterpretations[i] = HashMap.newHashMap(interpretationFactories.size());
73 } 74 }
74 } 75 }
75 // Create the partial interpretations in order so that factories may refer to interpretations of symbols 76 // Create the partial interpretations in order so that factories may refer to interpretations of symbols
@@ -87,7 +88,7 @@ class ReasoningAdapterImpl implements ReasoningAdapter {
87 } 88 }
88 } 89 }
89 90
90 private <A, C> PartialInterpretation<A, C> createPartialInterpretation( 91 private <A extends AbstractValue<A, C>, C> PartialInterpretation<A, C> createPartialInterpretation(
91 Concreteness concreteness, PartialInterpretation.Factory<A, C> interpreter, AnyPartialSymbol symbol) { 92 Concreteness concreteness, PartialInterpretation.Factory<A, C> interpreter, AnyPartialSymbol symbol) {
92 // The builder only allows well-typed assignment of interpreters to symbols. 93 // The builder only allows well-typed assignment of interpreters to symbols.
93 @SuppressWarnings("unchecked") 94 @SuppressWarnings("unchecked")
@@ -107,7 +108,7 @@ class ReasoningAdapterImpl implements ReasoningAdapter {
107 } 108 }
108 } 109 }
109 110
110 private <A, C> PartialInterpretationRefiner<A, C> createRefiner( 111 private <A extends AbstractValue<A, C>, C> PartialInterpretationRefiner<A, C> createRefiner(
111 PartialInterpretationRefiner.Factory<A, C> factory, AnyPartialSymbol symbol) { 112 PartialInterpretationRefiner.Factory<A, C> factory, AnyPartialSymbol symbol) {
112 // The builder only allows well-typed assignment of interpreters to symbols. 113 // The builder only allows well-typed assignment of interpreters to symbols.
113 @SuppressWarnings("unchecked") 114 @SuppressWarnings("unchecked")
@@ -126,8 +127,8 @@ class ReasoningAdapterImpl implements ReasoningAdapter {
126 } 127 }
127 128
128 @Override 129 @Override
129 public <A, C> PartialInterpretation<A, C> getPartialInterpretation(Concreteness concreteness, 130 public <A extends AbstractValue<A, C>, C> PartialInterpretation<A, C> getPartialInterpretation(
130 PartialSymbol<A, C> partialSymbol) { 131 Concreteness concreteness, PartialSymbol<A, C> partialSymbol) {
131 var map = partialInterpretations[concreteness.ordinal()]; 132 var map = partialInterpretations[concreteness.ordinal()];
132 if (map == null) { 133 if (map == null) {
133 throw new IllegalArgumentException("No interpretation for concreteness: " + concreteness); 134 throw new IllegalArgumentException("No interpretation for concreteness: " + concreteness);
@@ -143,7 +144,8 @@ class ReasoningAdapterImpl implements ReasoningAdapter {
143 } 144 }
144 145
145 @Override 146 @Override
146 public <A, C> PartialInterpretationRefiner<A, C> getRefiner(PartialSymbol<A, C> partialSymbol) { 147 public <A extends AbstractValue<A, C>, C> PartialInterpretationRefiner<A, C> getRefiner(
148 PartialSymbol<A, C> partialSymbol) {
147 var refiner = refiners.get(partialSymbol); 149 var refiner = refiners.get(partialSymbol);
148 if (refiner == null) { 150 if (refiner == null) {
149 throw new IllegalArgumentException("No refiner for partial symbol: " + partialSymbol); 151 throw new IllegalArgumentException("No refiner for partial symbol: " + partialSymbol);