blob: fc8406aa30187de0bb38fe65a826c5877bab12d3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
/*
* SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
*
* SPDX-License-Identifier: EPL-2.0
*/
package tools.refinery.store.query.valuation;
import tools.refinery.store.query.term.AnyDataVariable;
import tools.refinery.store.query.term.DataVariable;
import java.util.Set;
public record RestrictedValuation(Valuation valuation, Set<AnyDataVariable> allowedVariables) implements Valuation {
@Override
public <T> T getValue(DataVariable<T> variable) {
if (!allowedVariables.contains(variable)) {
throw new IllegalArgumentException("Variable %s is not in scope".formatted(variable));
}
return valuation.getValue(variable);
}
}
|