aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/store
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2023-03-01 21:20:10 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2023-03-01 21:20:10 +0100
commit2bf484cd882949c53a82c40e28319f74ef8ae477 (patch)
tree083eb6793b0fc6fd77f402c51cd5579cfa4c56a2 /subprojects/store
parentrefactor: more direct access to VIATRA result set (diff)
downloadrefinery-2bf484cd882949c53a82c40e28319f74ef8ae477.tar.gz
refinery-2bf484cd882949c53a82c40e28319f74ef8ae477.tar.zst
refinery-2bf484cd882949c53a82c40e28319f74ef8ae477.zip
refactor: use Cursor in query result sets
Diffstat (limited to 'subprojects/store')
-rw-r--r--subprojects/store/src/main/java/tools/refinery/store/map/Cursors.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/subprojects/store/src/main/java/tools/refinery/store/map/Cursors.java b/subprojects/store/src/main/java/tools/refinery/store/map/Cursors.java
new file mode 100644
index 00000000..fc8e628b
--- /dev/null
+++ b/subprojects/store/src/main/java/tools/refinery/store/map/Cursors.java
@@ -0,0 +1,36 @@
1package tools.refinery.store.map;
2
3public final class Cursors {
4 private Cursors() {
5 throw new IllegalStateException("This is a static utility class and should not be instantiated directly");
6 }
7
8 public static <K, V> Cursor<K, V> empty() {
9 return new Empty<>();
10 }
11
12 private static class Empty<K, V> implements Cursor<K, V> {
13 private boolean terminated = false;
14
15 @Override
16 public K getKey() {
17 return null;
18 }
19
20 @Override
21 public V getValue() {
22 return null;
23 }
24
25 @Override
26 public boolean isTerminated() {
27 return terminated;
28 }
29
30 @Override
31 public boolean move() {
32 terminated = true;
33 return false;
34 }
35 }
36}