aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/seed/SeedInitializer.java
blob: 138e3a640ee3232e83fafcbfec561d99cd242fc7 (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
29
/*
 * SPDX-FileCopyrightText: 2023-2024 The Refinery Authors <https://refinery.tools/>
 *
 * SPDX-License-Identifier: EPL-2.0
 */
package tools.refinery.store.reasoning.seed;

import tools.refinery.logic.AbstractValue;
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 extends AbstractValue<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);
	}
}