diff options
Diffstat (limited to 'subprojects/store-dse/src/main/java/tools/refinery/store/dse/modification/actions/DeleteActionLiteral.java')
-rw-r--r-- | subprojects/store-dse/src/main/java/tools/refinery/store/dse/modification/actions/DeleteActionLiteral.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/subprojects/store-dse/src/main/java/tools/refinery/store/dse/modification/actions/DeleteActionLiteral.java b/subprojects/store-dse/src/main/java/tools/refinery/store/dse/modification/actions/DeleteActionLiteral.java new file mode 100644 index 00000000..18ad2b9d --- /dev/null +++ b/subprojects/store-dse/src/main/java/tools/refinery/store/dse/modification/actions/DeleteActionLiteral.java | |||
@@ -0,0 +1,51 @@ | |||
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.modification.actions; | ||
7 | |||
8 | import tools.refinery.store.dse.modification.DanglingEdges; | ||
9 | import tools.refinery.store.dse.modification.ModificationAdapter; | ||
10 | import tools.refinery.store.dse.transition.actions.AbstractActionLiteral; | ||
11 | import tools.refinery.store.dse.transition.actions.BoundActionLiteral; | ||
12 | import tools.refinery.store.model.Model; | ||
13 | import tools.refinery.store.query.term.NodeVariable; | ||
14 | import tools.refinery.store.tuple.Tuple; | ||
15 | |||
16 | import java.util.List; | ||
17 | |||
18 | public class DeleteActionLiteral extends AbstractActionLiteral { | ||
19 | private final NodeVariable variable; | ||
20 | private final DanglingEdges danglingEdges; | ||
21 | |||
22 | public DeleteActionLiteral(NodeVariable variable, DanglingEdges danglingEdges) { | ||
23 | |||
24 | this.variable = variable; | ||
25 | this.danglingEdges = danglingEdges; | ||
26 | } | ||
27 | |||
28 | public NodeVariable getVariable() { | ||
29 | return variable; | ||
30 | } | ||
31 | |||
32 | public DanglingEdges getDanglingEdges() { | ||
33 | return danglingEdges; | ||
34 | } | ||
35 | |||
36 | @Override | ||
37 | public List<NodeVariable> getInputVariables() { | ||
38 | return List.of(variable); | ||
39 | } | ||
40 | |||
41 | @Override | ||
42 | public List<NodeVariable> getOutputVariables() { | ||
43 | return List.of(); | ||
44 | } | ||
45 | |||
46 | @Override | ||
47 | public BoundActionLiteral bindToModel(Model model) { | ||
48 | var adapter = model.getAdapter(ModificationAdapter.class); | ||
49 | return tuple -> adapter.deleteObject(tuple, danglingEdges) ? Tuple.of() : null; | ||
50 | } | ||
51 | } | ||