diff options
Diffstat (limited to 'subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/refinement')
4 files changed, 18 insertions, 11 deletions
diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/refinement/AbstractPartialInterpretationRefiner.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/refinement/AbstractPartialInterpretationRefiner.java index a7fc5b7e..42943490 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/refinement/AbstractPartialInterpretationRefiner.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/refinement/AbstractPartialInterpretationRefiner.java | |||
@@ -1,14 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/> | 2 | * SPDX-FileCopyrightText: 2023-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 | */ |
6 | package tools.refinery.store.reasoning.refinement; | 6 | package tools.refinery.store.reasoning.refinement; |
7 | 7 | ||
8 | import tools.refinery.logic.AbstractValue; | ||
8 | import tools.refinery.store.reasoning.ReasoningAdapter; | 9 | import tools.refinery.store.reasoning.ReasoningAdapter; |
9 | import tools.refinery.store.reasoning.representation.PartialSymbol; | 10 | import tools.refinery.store.reasoning.representation.PartialSymbol; |
10 | 11 | ||
11 | public abstract class AbstractPartialInterpretationRefiner<A, C> implements PartialInterpretationRefiner<A, C> { | 12 | public abstract class AbstractPartialInterpretationRefiner<A extends AbstractValue<A, C>, C> |
13 | implements PartialInterpretationRefiner<A, C> { | ||
12 | private final ReasoningAdapter adapter; | 14 | private final ReasoningAdapter adapter; |
13 | private final PartialSymbol<A, C> partialSymbol; | 15 | private final PartialSymbol<A, C> partialSymbol; |
14 | 16 | ||
diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/refinement/ConcreteSymbolRefiner.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/refinement/ConcreteSymbolRefiner.java index ebb9b824..d6ac0e9d 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/refinement/ConcreteSymbolRefiner.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/refinement/ConcreteSymbolRefiner.java | |||
@@ -1,10 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/> | 2 | * SPDX-FileCopyrightText: 2023-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 | */ |
6 | package tools.refinery.store.reasoning.refinement; | 6 | package tools.refinery.store.reasoning.refinement; |
7 | 7 | ||
8 | import tools.refinery.logic.AbstractValue; | ||
8 | import tools.refinery.store.model.Interpretation; | 9 | import tools.refinery.store.model.Interpretation; |
9 | import tools.refinery.store.reasoning.ReasoningAdapter; | 10 | import tools.refinery.store.reasoning.ReasoningAdapter; |
10 | import tools.refinery.store.reasoning.representation.PartialSymbol; | 11 | import tools.refinery.store.reasoning.representation.PartialSymbol; |
@@ -13,7 +14,8 @@ import tools.refinery.store.tuple.Tuple; | |||
13 | 14 | ||
14 | import java.util.Objects; | 15 | import java.util.Objects; |
15 | 16 | ||
16 | public class ConcreteSymbolRefiner<A, C> extends AbstractPartialInterpretationRefiner<A, C> { | 17 | public class ConcreteSymbolRefiner<A extends AbstractValue<A, C>, C> |
18 | extends AbstractPartialInterpretationRefiner<A, C> { | ||
17 | private final Interpretation<A> interpretation; | 19 | private final Interpretation<A> interpretation; |
18 | 20 | ||
19 | public ConcreteSymbolRefiner(ReasoningAdapter adapter, PartialSymbol<A, C> partialSymbol, | 21 | public ConcreteSymbolRefiner(ReasoningAdapter adapter, PartialSymbol<A, C> partialSymbol, |
@@ -25,14 +27,14 @@ public class ConcreteSymbolRefiner<A, C> extends AbstractPartialInterpretationRe | |||
25 | @Override | 27 | @Override |
26 | public boolean merge(Tuple key, A value) { | 28 | public boolean merge(Tuple key, A value) { |
27 | var currentValue = interpretation.get(key); | 29 | var currentValue = interpretation.get(key); |
28 | var mergedValue = getPartialSymbol().abstractDomain().commonRefinement(currentValue, value); | 30 | var mergedValue = currentValue.meet(value); |
29 | if (!Objects.equals(currentValue, mergedValue)) { | 31 | if (!Objects.equals(currentValue, mergedValue)) { |
30 | interpretation.put(key, mergedValue); | 32 | interpretation.put(key, mergedValue); |
31 | } | 33 | } |
32 | return true; | 34 | return true; |
33 | } | 35 | } |
34 | 36 | ||
35 | public static <A1, C1> Factory<A1, C1> of(Symbol<A1> concreteSymbol) { | 37 | public static <A1 extends AbstractValue<A1, C1>, C1> Factory<A1, C1> of(Symbol<A1> concreteSymbol) { |
36 | return (adapter, partialSymbol) -> new ConcreteSymbolRefiner<>(adapter, partialSymbol, concreteSymbol); | 38 | return (adapter, partialSymbol) -> new ConcreteSymbolRefiner<>(adapter, partialSymbol, concreteSymbol); |
37 | } | 39 | } |
38 | } | 40 | } |
diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/refinement/PartialInterpretationRefiner.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/refinement/PartialInterpretationRefiner.java index f48d1d1f..c8b182b8 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/refinement/PartialInterpretationRefiner.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/refinement/PartialInterpretationRefiner.java | |||
@@ -1,22 +1,24 @@ | |||
1 | /* | 1 | /* |
2 | * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/> | 2 | * SPDX-FileCopyrightText: 2023-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 | */ |
6 | package tools.refinery.store.reasoning.refinement; | 6 | package tools.refinery.store.reasoning.refinement; |
7 | 7 | ||
8 | import tools.refinery.logic.AbstractValue; | ||
8 | import tools.refinery.store.reasoning.ReasoningAdapter; | 9 | import tools.refinery.store.reasoning.ReasoningAdapter; |
9 | import tools.refinery.store.reasoning.representation.PartialSymbol; | 10 | import tools.refinery.store.reasoning.representation.PartialSymbol; |
10 | import tools.refinery.store.tuple.Tuple; | 11 | import tools.refinery.store.tuple.Tuple; |
11 | 12 | ||
12 | public non-sealed interface PartialInterpretationRefiner<A, C> extends AnyPartialInterpretationRefiner { | 13 | public non-sealed interface PartialInterpretationRefiner<A extends AbstractValue<A, C>, C> |
14 | extends AnyPartialInterpretationRefiner { | ||
13 | @Override | 15 | @Override |
14 | PartialSymbol<A, C> getPartialSymbol(); | 16 | PartialSymbol<A, C> getPartialSymbol(); |
15 | 17 | ||
16 | boolean merge(Tuple key, A value); | 18 | boolean merge(Tuple key, A value); |
17 | 19 | ||
18 | @FunctionalInterface | 20 | @FunctionalInterface |
19 | interface Factory<A, C> { | 21 | interface Factory<A extends AbstractValue<A, C>, C> { |
20 | PartialInterpretationRefiner<A, C> create(ReasoningAdapter adapter, PartialSymbol<A, C> partialSymbol); | 22 | PartialInterpretationRefiner<A, C> create(ReasoningAdapter adapter, PartialSymbol<A, C> partialSymbol); |
21 | } | 23 | } |
22 | } | 24 | } |
diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/refinement/RefinementBasedInitializer.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/refinement/RefinementBasedInitializer.java index b6bccb01..1a2c03a6 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/refinement/RefinementBasedInitializer.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/refinement/RefinementBasedInitializer.java | |||
@@ -1,16 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/> | 2 | * SPDX-FileCopyrightText: 2023-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 | */ |
6 | package tools.refinery.store.reasoning.refinement; | 6 | package tools.refinery.store.reasoning.refinement; |
7 | 7 | ||
8 | import tools.refinery.logic.AbstractValue; | ||
8 | import tools.refinery.store.model.Model; | 9 | import tools.refinery.store.model.Model; |
9 | import tools.refinery.store.reasoning.ReasoningAdapter; | 10 | import tools.refinery.store.reasoning.ReasoningAdapter; |
10 | import tools.refinery.store.reasoning.representation.PartialSymbol; | 11 | import tools.refinery.store.reasoning.representation.PartialSymbol; |
11 | import tools.refinery.store.reasoning.seed.ModelSeed; | 12 | import tools.refinery.store.reasoning.seed.ModelSeed; |
12 | 13 | ||
13 | public class RefinementBasedInitializer<A, C> implements PartialModelInitializer { | 14 | public class RefinementBasedInitializer<A extends AbstractValue<A, C>, C> implements PartialModelInitializer { |
14 | private final PartialSymbol<A, C> partialSymbol; | 15 | private final PartialSymbol<A, C> partialSymbol; |
15 | 16 | ||
16 | public RefinementBasedInitializer(PartialSymbol<A, C> partialSymbol) { | 17 | public RefinementBasedInitializer(PartialSymbol<A, C> partialSymbol) { |