diff options
Diffstat (limited to 'subprojects/store-dse/src/main/java/tools/refinery/store/dse/internal/action/NewItemVariable.java')
-rw-r--r-- | subprojects/store-dse/src/main/java/tools/refinery/store/dse/internal/action/NewItemVariable.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/subprojects/store-dse/src/main/java/tools/refinery/store/dse/internal/action/NewItemVariable.java b/subprojects/store-dse/src/main/java/tools/refinery/store/dse/internal/action/NewItemVariable.java new file mode 100644 index 00000000..65b1f544 --- /dev/null +++ b/subprojects/store-dse/src/main/java/tools/refinery/store/dse/internal/action/NewItemVariable.java | |||
@@ -0,0 +1,40 @@ | |||
1 | package tools.refinery.store.dse.internal.action; | ||
2 | |||
3 | import tools.refinery.store.dse.DesignSpaceExplorationAdapter; | ||
4 | import tools.refinery.store.model.Model; | ||
5 | import tools.refinery.store.tuple.Tuple; | ||
6 | import tools.refinery.store.tuple.Tuple1; | ||
7 | |||
8 | public class NewItemVariable implements ActionVariable { | ||
9 | private DesignSpaceExplorationAdapter dseAdapter; | ||
10 | private Tuple1 value; | ||
11 | |||
12 | @Override | ||
13 | public void fire(Tuple activation) { | ||
14 | value = dseAdapter.createObject(); | ||
15 | } | ||
16 | |||
17 | @Override | ||
18 | public NewItemVariable prepare(Model model) { | ||
19 | dseAdapter = model.getAdapter(DesignSpaceExplorationAdapter.class); | ||
20 | return this; | ||
21 | } | ||
22 | |||
23 | @Override | ||
24 | public Tuple1 getValue() { | ||
25 | return value; | ||
26 | } | ||
27 | |||
28 | @Override | ||
29 | public boolean equalsWithSubstitution(AtomicAction other) { | ||
30 | if (other == null || getClass() != other.getClass()) { | ||
31 | return false; | ||
32 | } | ||
33 | var otherAction = (NewItemVariable) other; | ||
34 | if (value == null) { | ||
35 | return otherAction.value == null; | ||
36 | } | ||
37 | return value.equals(otherAction.value); | ||
38 | |||
39 | } | ||
40 | } | ||