aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/ModelSeed.java
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/ModelSeed.java')
-rw-r--r--subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/ModelSeed.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/ModelSeed.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/ModelSeed.java
index e6b3eaf9..9cd4862b 100644
--- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/ModelSeed.java
+++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/ModelSeed.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 */
6package tools.refinery.store.reasoning.seed; 6package tools.refinery.store.reasoning.seed;
7 7
8import tools.refinery.logic.AbstractValue;
8import tools.refinery.store.map.Cursor; 9import tools.refinery.store.map.Cursor;
9import tools.refinery.store.reasoning.representation.AnyPartialSymbol; 10import tools.refinery.store.reasoning.representation.AnyPartialSymbol;
10import tools.refinery.store.reasoning.representation.PartialSymbol; 11import tools.refinery.store.reasoning.representation.PartialSymbol;
@@ -29,7 +30,7 @@ public class ModelSeed {
29 return nodeCount; 30 return nodeCount;
30 } 31 }
31 32
32 public <A> Seed<A> getSeed(PartialSymbol<A, ?> partialSymbol) { 33 public <A extends AbstractValue<A, ?>> Seed<A> getSeed(PartialSymbol<A, ?> partialSymbol) {
33 var seed = seeds.get(partialSymbol); 34 var seed = seeds.get(partialSymbol);
34 if (seed == null) { 35 if (seed == null) {
35 throw new IllegalArgumentException("No seed for partial symbol " + partialSymbol); 36 throw new IllegalArgumentException("No seed for partial symbol " + partialSymbol);
@@ -48,7 +49,8 @@ public class ModelSeed {
48 return Collections.unmodifiableSet(seeds.keySet()); 49 return Collections.unmodifiableSet(seeds.keySet());
49 } 50 }
50 51
51 public <A> Cursor<Tuple, A> getCursor(PartialSymbol<A, ?> partialSymbol, A defaultValue) { 52 public <A extends AbstractValue<A, ?>> Cursor<Tuple, A> getCursor(PartialSymbol<A, ?> partialSymbol,
53 A defaultValue) {
52 return getSeed(partialSymbol).getCursor(defaultValue, nodeCount); 54 return getSeed(partialSymbol).getCursor(defaultValue, nodeCount);
53 } 55 }
54 56
@@ -67,7 +69,7 @@ public class ModelSeed {
67 this.nodeCount = nodeCount; 69 this.nodeCount = nodeCount;
68 } 70 }
69 71
70 public <A> Builder seed(PartialSymbol<A, ?> partialSymbol, Seed<A> seed) { 72 public <A extends AbstractValue<A, ?>> Builder seed(PartialSymbol<A, ?> partialSymbol, Seed<A> seed) {
71 if (seed.arity() != partialSymbol.arity()) { 73 if (seed.arity() != partialSymbol.arity()) {
72 throw new IllegalStateException("Expected seed of arity %d for partial symbol %s, but got %d instead" 74 throw new IllegalStateException("Expected seed of arity %d for partial symbol %s, but got %d instead"
73 .formatted(partialSymbol.arity(), partialSymbol, seed.arity())); 75 .formatted(partialSymbol.arity(), partialSymbol, seed.arity()));
@@ -82,7 +84,8 @@ public class ModelSeed {
82 return this; 84 return this;
83 } 85 }
84 86
85 public <A> Builder seed(PartialSymbol<A, ?> partialSymbol, Consumer<Seed.Builder<A>> callback) { 87 public <A extends AbstractValue<A, ?>> Builder seed(PartialSymbol<A, ?> partialSymbol,
88 Consumer<Seed.Builder<A>> callback) {
86 var builder = Seed.builder(partialSymbol); 89 var builder = Seed.builder(partialSymbol);
87 callback.accept(builder); 90 callback.accept(builder);
88 return seed(partialSymbol, builder.build()); 91 return seed(partialSymbol, builder.build());