aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/ValueProviderBasedValuation.java
blob: a69c8bd2502fde7f45980cba8e6845ae1a73a98d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
 *
 * SPDX-License-Identifier: EPL-2.0
 */
package tools.refinery.store.query.interpreter.internal.pquery;

import tools.refinery.interpreter.matchers.psystem.IValueProvider;
import tools.refinery.logic.term.DataVariable;
import tools.refinery.logic.valuation.Valuation;

public record ValueProviderBasedValuation(IValueProvider valueProvider) implements Valuation {
	@Override
	public <T> T getValue(DataVariable<T> variable) {
		@SuppressWarnings("unchecked")
		var value = (T) valueProvider.getValue(variable.getUniqueName());
		return value;
	}
}