diff options
Diffstat (limited to 'subprojects/store-dse/src/main/java/tools/refinery/store/dse/transition/actions/ActionLiterals.java')
-rw-r--r-- | subprojects/store-dse/src/main/java/tools/refinery/store/dse/transition/actions/ActionLiterals.java | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/subprojects/store-dse/src/main/java/tools/refinery/store/dse/transition/actions/ActionLiterals.java b/subprojects/store-dse/src/main/java/tools/refinery/store/dse/transition/actions/ActionLiterals.java new file mode 100644 index 00000000..275e1e25 --- /dev/null +++ b/subprojects/store-dse/src/main/java/tools/refinery/store/dse/transition/actions/ActionLiterals.java | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | package tools.refinery.store.dse.transition.actions; | ||
7 | |||
8 | import tools.refinery.store.query.term.NodeVariable; | ||
9 | import tools.refinery.store.representation.Symbol; | ||
10 | |||
11 | import java.util.List; | ||
12 | import java.util.Objects; | ||
13 | |||
14 | public final class ActionLiterals { | ||
15 | private ActionLiterals() { | ||
16 | throw new IllegalArgumentException("This is a static utility class and should not be instantiated directly"); | ||
17 | } | ||
18 | |||
19 | public static <T> PutActionLiteral<T> put(Symbol<T> symbol, T value, NodeVariable... parameters) { | ||
20 | return new PutActionLiteral<>(symbol, value, List.of(parameters)); | ||
21 | } | ||
22 | |||
23 | public static PutActionLiteral<Boolean> add(Symbol<Boolean> symbol, NodeVariable... parameters) { | ||
24 | if (!Objects.equals(symbol.defaultValue(), false)) { | ||
25 | throw new IllegalArgumentException("Use put to add a value to symbols other than two-valued logic"); | ||
26 | } | ||
27 | return put(symbol, true, parameters); | ||
28 | } | ||
29 | |||
30 | public static <T> PutActionLiteral<T> remove(Symbol<T> symbol, NodeVariable... parameters) { | ||
31 | return put(symbol, symbol.defaultValue(), parameters); | ||
32 | } | ||
33 | } | ||