blob: 5d4654da1962cd3ecfb42467057bac8d37e53ee2 (
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
30
31
32
33
|
package tools.refinery.store.query.substitution;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import tools.refinery.store.query.term.Variable;
import java.util.Map;
public final class Substitutions {
private Substitutions() {
throw new IllegalStateException("This is a static utility class and should not be instantiate directly");
}
public static Substitution total(Map<Variable, Variable> map) {
return new MapBasedSubstitution(map, StatelessSubstitution.FAILING);
}
public static Substitution partial(Map<Variable, Variable> map) {
return new MapBasedSubstitution(map, StatelessSubstitution.IDENTITY);
}
public static Substitution renewing(Map<Variable, Variable> map) {
return new MapBasedSubstitution(map, renewing());
}
public static Substitution renewing() {
return new RenewingSubstitution();
}
public static Substitution compose(@Nullable Substitution first, @NotNull Substitution second) {
return first == null ? second : first.andThen(second);
}
}
|