KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > h2 > index > MetaCursor


1 /*
2  * Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
3  * Initial Developer: H2 Group
4  */

5 package org.h2.index;
6
7 import java.sql.SQLException JavaDoc;
8
9 import org.h2.message.Message;
10 import org.h2.result.Row;
11 import org.h2.util.ObjectArray;
12
13
14 /**
15  * @author Thomas
16  */

17
18 public class MetaCursor implements Cursor {
19
20     private Row current;
21     private ObjectArray rows;
22     private int index;
23     
24     MetaCursor(ObjectArray rows) {
25         this.rows = rows;
26     }
27     
28     public Row get() {
29         return current;
30     }
31     
32     public int getPos() {
33         throw Message.getInternalError();
34     }
35
36     public boolean next() throws SQLException JavaDoc {
37         current = (Row) (index >= rows.size() ? null : rows.get(index++));
38         return current != null;
39     }
40
41 }
42
Popular Tags