aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects
diff options
context:
space:
mode:
authorLibravatar OszkarSemerath <semerath@mit.bme.hu>2023-02-14 00:32:26 +0100
committerLibravatar OszkarSemerath <semerath@mit.bme.hu>2023-02-14 00:32:26 +0100
commitb5026e94f87bb619ea66d84e7799e089cfb8fa07 (patch)
treea3202a98cb6d75d1f092419e39b963e607e03cf3 /subprojects
parentPotential synchronization issue fixed in VersionedMapStoreDeltaImpl.getStates (diff)
downloadrefinery-b5026e94f87bb619ea66d84e7799e089cfb8fa07.tar.gz
refinery-b5026e94f87bb619ea66d84e7799e089cfb8fa07.tar.zst
refinery-b5026e94f87bb619ea66d84e7799e089cfb8fa07.zip
Nasty error fixed in VersionedMapStoreDeltaImpl.java
when setting the new parent state
Diffstat (limited to 'subprojects')
-rw-r--r--subprojects/store/src/main/java/tools/refinery/store/map/VersionedMapStoreDeltaImpl.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMapStoreDeltaImpl.java b/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMapStoreDeltaImpl.java
index f41a2d75..31cdbf95 100644
--- a/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMapStoreDeltaImpl.java
+++ b/subprojects/store/src/main/java/tools/refinery/store/map/VersionedMapStoreDeltaImpl.java
@@ -50,19 +50,22 @@ public class VersionedMapStoreDeltaImpl<K, V> implements VersionedMapStore<K, V>
50 } 50 }
51 51
52 public MapTransaction<K, V> getPath(long to, List<MapDelta<K, V>[]> forwardTransactions) { 52 public MapTransaction<K, V> getPath(long to, List<MapDelta<K, V>[]> forwardTransactions) {
53 MapTransaction<K, V> toTransaction = getState(to); 53 final MapTransaction<K, V> target = getState(to);
54 MapTransaction<K, V> toTransaction = target;
54 while (toTransaction != null) { 55 while (toTransaction != null) {
55 forwardTransactions.add(toTransaction.deltas()); 56 forwardTransactions.add(toTransaction.deltas());
56 toTransaction = toTransaction.parent(); 57 toTransaction = toTransaction.parent();
57 } 58 }
58 return toTransaction; 59 return target;
59 } 60 }
60 61
61 public MapTransaction<K, V> getPath(long from, long to, 62 public MapTransaction<K, V> getPath(long from, long to,
62 List<MapDelta<K, V>[]> backwardTransactions, 63 List<MapDelta<K, V>[]> backwardTransactions,
63 List<MapDelta<K, V>[]> forwardTransactions) { 64 List<MapDelta<K, V>[]> forwardTransactions) {
64 MapTransaction<K, V> fromTransaction = getState(from); 65 MapTransaction<K, V> fromTransaction = getState(from);
65 MapTransaction<K, V> toTransaction = getState(to); 66 final MapTransaction<K, V> target = getState(to);
67 MapTransaction<K, V> toTransaction = target;
68
66 while (fromTransaction != toTransaction) { 69 while (fromTransaction != toTransaction) {
67 if (fromTransaction == null || (toTransaction != null && fromTransaction.version() < toTransaction.version())) { 70 if (fromTransaction == null || (toTransaction != null && fromTransaction.version() < toTransaction.version())) {
68 forwardTransactions.add(toTransaction.deltas()); 71 forwardTransactions.add(toTransaction.deltas());
@@ -72,7 +75,7 @@ public class VersionedMapStoreDeltaImpl<K, V> implements VersionedMapStore<K, V>
72 fromTransaction = fromTransaction.parent(); 75 fromTransaction = fromTransaction.parent();
73 } 76 }
74 } 77 }
75 return toTransaction; 78 return target;
76 } 79 }
77 80
78 81