1 5 package org.h2.index; 6 7 import java.sql.SQLException ; 8 9 import org.h2.message.Message; 10 import org.h2.result.Row; 11 import org.h2.value.Value; 12 import org.h2.value.ValueLong; 13 14 public class RangeCursor implements Cursor { 15 16 private boolean beforeFirst; 17 private long current; 18 private Row currentRow; 19 private long min, max; 20 21 RangeCursor(long min, long max) { 22 this.min = min; 23 this.max = max; 24 beforeFirst = true; 25 } 26 27 public Row get() { 28 return currentRow; 29 } 30 31 public int getPos() { 32 throw Message.getInternalError(); 33 } 34 35 public boolean next() throws SQLException { 36 if(beforeFirst) { 37 beforeFirst = false; 38 current = min; 39 } else { 40 current++; 41 } 42 currentRow = new Row(new Value[]{ValueLong.get(current)}); 43 return current <= max; 44 } 45 46 } 47 | Popular Tags |