blob: 148d4156022253fb5d30c37322f450be743488e2 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
package tools.refinery.store.dse.internal.action;
import tools.refinery.store.model.Model;
import tools.refinery.store.tuple.Tuple;
public class ActivationVariable implements ActionVariable {
private final int index;
private Tuple value;
public ActivationVariable() {
this(0);
}
public ActivationVariable(int index) {
this.index = index;
}
@Override
public void fire(Tuple activation) {
value = Tuple.of(activation.get(index));
}
@Override
public ActivationVariable prepare(Model model) {
return this;
}
@Override
public Tuple getValue() {
return value;
}
@Override
public boolean equalsWithSubstitution(AtomicAction other) {
if (other == null || getClass() != other.getClass()) {
return false;
}
var otherAction = (ActivationVariable) other;
if (index != otherAction.index) {
return false;
}
if (value == null) {
return otherAction.value == null;
}
return value.equals(otherAction.value);
}
}
|