blob: 54d18a3f19a2d767df27b68760cfb6ef3a2ec3a9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
package tools.refinery.store.query.substitution;
import tools.refinery.store.query.Variable;
import java.util.HashMap;
import java.util.Map;
public class RenewingSubstitution implements Substitution {
private final Map<Variable, Variable> alreadyRenewed = new HashMap<>();
@Override
public Variable getSubstitute(Variable variable) {
return alreadyRenewed.computeIfAbsent(variable, RenewingSubstitution::renew);
}
private static Variable renew(Variable variable) {
return variable.isExplicitlyNamed() ? new Variable(variable.getName()) : new Variable();
}
}
|