diff options
Diffstat (limited to 'subprojects/store/src/main/java')
-rw-r--r-- | subprojects/store/src/main/java/tools/refinery/store/map/VersionedMapStoreDeltaImpl.java | 11 |
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 | ||