diff options
Diffstat (limited to 'subprojects/store/src/main/java/tools')
-rw-r--r-- | subprojects/store/src/main/java/tools/refinery/store/map/internal/MapDiffCursor.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/internal/MapDiffCursor.java b/subprojects/store/src/main/java/tools/refinery/store/map/internal/MapDiffCursor.java index beaff13b..6c076ce5 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/map/internal/MapDiffCursor.java +++ b/subprojects/store/src/main/java/tools/refinery/store/map/internal/MapDiffCursor.java | |||
@@ -5,6 +5,7 @@ import tools.refinery.store.map.ContinousHashProvider; | |||
5 | import tools.refinery.store.map.Cursor; | 5 | import tools.refinery.store.map.Cursor; |
6 | import tools.refinery.store.map.DiffCursor; | 6 | import tools.refinery.store.map.DiffCursor; |
7 | 7 | ||
8 | import java.util.Objects; | ||
8 | import java.util.Set; | 9 | import java.util.Set; |
9 | import java.util.stream.Collectors; | 10 | import java.util.stream.Collectors; |
10 | import java.util.stream.Stream; | 11 | import java.util.stream.Stream; |
@@ -121,7 +122,7 @@ public class MapDiffCursor<K, V> implements DiffCursor<K, V>, Cursor<K, V> { | |||
121 | this.fromValue = defaultValue; | 122 | this.fromValue = defaultValue; |
122 | this.toValue = cursor2.value; | 123 | this.toValue = cursor2.value; |
123 | } else { | 124 | } else { |
124 | throw new IllegalArgumentException("Inconsistent compare result for diffcursor"); | 125 | throw new IllegalArgumentException("Inconsistent compare result for diffCursor"); |
125 | } | 126 | } |
126 | } | 127 | } |
127 | 128 | ||
@@ -145,16 +146,17 @@ public class MapDiffCursor<K, V> implements DiffCursor<K, V>, Cursor<K, V> { | |||
145 | this.fromValue = defaultValue; | 146 | this.fromValue = defaultValue; |
146 | this.toValue = cursor2.value; | 147 | this.toValue = cursor2.value; |
147 | } | 148 | } |
148 | default -> throw new IllegalArgumentException("Inconsistent compare result for diffcursor"); | 149 | default -> throw new IllegalArgumentException("Inconsistent compare result for diffCursor"); |
149 | } | 150 | } |
150 | } | 151 | } |
151 | 152 | ||
153 | /** | ||
154 | * Checks if two states has the same values, i.e., there is no difference. | ||
155 | * @return whether two states has the same values | ||
156 | */ | ||
152 | protected boolean sameValues() { | 157 | protected boolean sameValues() { |
153 | if (this.fromValue == null) { | 158 | if(cursor1.isTerminated() || cursor2.isTerminated()) return false; |
154 | return this.toValue == null; | 159 | else return Objects.equals(this.fromValue, this.toValue); |
155 | } else { | ||
156 | return this.fromValue.equals(this.toValue); | ||
157 | } | ||
158 | } | 160 | } |
159 | 161 | ||
160 | protected boolean moveOne() { | 162 | protected boolean moveOne() { |