aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/SeedInitializer.java
blob: 9af457d85d1495e24008e0aed41bc90368a6e48c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
 * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/>
 *
 * SPDX-License-Identifier: EPL-2.0
 */
package tools.refinery.store.reasoning.seed;

import tools.refinery.store.model.Model;
import tools.refinery.store.reasoning.refinement.PartialModelInitializer;
import tools.refinery.store.reasoning.representation.PartialSymbol;
import tools.refinery.store.representation.Symbol;

public class SeedInitializer<T> implements PartialModelInitializer {
	private final Symbol<T> symbol;
	private final PartialSymbol<T, ?> partialSymbol;

	public SeedInitializer(Symbol<T> symbol, PartialSymbol<T, ?> partialSymbol) {
		this.symbol = symbol;
		this.partialSymbol = partialSymbol;
	}

	@Override
	public void initialize(Model model, ModelSeed modelSeed) {
		var interpretation = model.getInterpretation(symbol);
		var cursor = modelSeed.getCursor(partialSymbol, symbol.defaultValue());
		interpretation.putAll(cursor);
	}
}