01: /*
02: * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
03: * (http://h2database.com/html/license.html).
04: * Initial Developer: H2 Group
05: */
06: package org.h2.index;
07:
08: import java.sql.SQLException;
09:
10: import org.h2.result.Row;
11: import org.h2.result.SearchRow;
12:
13: /**
14: * The cursor for a hash index.
15: * At most one row can be accessed.
16: */
17: public class HashCursor implements Cursor {
18: private Row row;
19: private boolean end;
20:
21: HashCursor(Row row) {
22: this .row = row;
23: }
24:
25: public Row get() {
26: return row;
27: }
28:
29: public SearchRow getSearchRow() throws SQLException {
30: return row;
31: }
32:
33: public int getPos() {
34: return row.getPos();
35: }
36:
37: public boolean next() {
38: if (row == null || end) {
39: row = null;
40: return false;
41: }
42: end = true;
43: return true;
44: }
45: }
|