This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on May 1st, 2013  |  syntax: Java  |  size: 0.82 KB  |  views: 30  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data