SHOW:
|
|
- or go back to the newest paste.
1 | public class RangeTest { | |
2 | public static class Itr extends WrappingIterator { | |
3 | boolean queried = false; | |
4 | ||
5 | public boolean hasTop() { | |
6 | return !queried; | |
7 | } | |
8 | ||
9 | public Key getTopKey() { | |
10 | return new Key("C"); | |
11 | } | |
12 | ||
13 | public Value getTopValue() { | |
14 | return new Value(new byte[0]); | |
15 | } | |
16 | ||
17 | public void next() { | |
18 | if(!queried) { | |
19 | queried = true; | |
20 | } | |
21 | } | |
22 | ||
23 | public Itr deepCopy(IteratrEnvironment env) { | |
24 | Itr i = new Itr(); | |
25 | i.setSource(this.getSource().deepCopy(env)); | |
26 | return i; | |
27 | } | |
28 | } | |
29 | ||
30 | public static void main(String[] args) throws Exception { | |
31 | Connector c; // do the instaniation stuff for these guys | |
32 | BatchScanner bs; | |
33 | bs.addScanIterator(new IteratorSetting(50, Itr.class)); | |
34 | bs.setRanges(Collections.singleton(new Range("A", "B")); | |
35 | for(Entry e : bs) System.out.println(e.getKey()); | |
36 | } | |
37 | } |