diff options
Diffstat (limited to 'subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/SeedInitializer.java')
-rw-r--r-- | subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/SeedInitializer.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/SeedInitializer.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/SeedInitializer.java new file mode 100644 index 00000000..9af457d8 --- /dev/null +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/SeedInitializer.java | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | package tools.refinery.store.reasoning.seed; | ||
7 | |||
8 | import tools.refinery.store.model.Model; | ||
9 | import tools.refinery.store.reasoning.refinement.PartialModelInitializer; | ||
10 | import tools.refinery.store.reasoning.representation.PartialSymbol; | ||
11 | import tools.refinery.store.representation.Symbol; | ||
12 | |||
13 | public class SeedInitializer<T> implements PartialModelInitializer { | ||
14 | private final Symbol<T> symbol; | ||
15 | private final PartialSymbol<T, ?> partialSymbol; | ||
16 | |||
17 | public SeedInitializer(Symbol<T> symbol, PartialSymbol<T, ?> partialSymbol) { | ||
18 | this.symbol = symbol; | ||
19 | this.partialSymbol = partialSymbol; | ||
20 | } | ||
21 | |||
22 | @Override | ||
23 | public void initialize(Model model, ModelSeed modelSeed) { | ||
24 | var interpretation = model.getInterpretation(symbol); | ||
25 | var cursor = modelSeed.getCursor(partialSymbol, symbol.defaultValue()); | ||
26 | interpretation.putAll(cursor); | ||
27 | } | ||
28 | } | ||