File D:\maven-qcr-plugin-testsunitaires\qcr4java\h2-1.3.170-sources\target\site\qc\lecode\index\MetaCursor.java.html

1 /*
2 * Copyright 2004-2011 H2 Group. Multiple-Licensed under the H2 License,
3 * Version 1.0, and under the Eclipse Public License, Version 1.0
4 * (http://h2database.com/html/license.html).
5 * Initial Developer: H2 Group
6 */
7 package org.h2.index;
8
9 import java.util.ArrayList;
10 import org.h2.message.DbException;
11 import org.h2.result.Row;
12 import org.h2.result.SearchRow;
13
14 /**
15 * An index for a meta data table.
16 * This index can only scan through all rows, search is not supported.
17 */
18 public class MetaCursor implements Cursor {
19
20 private Row current;
21 private final ArrayList<Row> rows;
22 private int index;
23
24 MetaCursor(ArrayList<Row> rows) {
25 this.rows = rows;
26 }
27
28 public Row get() {
29 return current;
30 }
31
32 public SearchRow getSearchRow() {
33 return current;
34 }
35
36 public boolean next() {
37 current = index >= rows.size() ? null : rows.get(index++);
38 return current != null;
39 }
40
41 public boolean previous() {
42 throw DbException.throwInternalError();
43 }
44
45 }
46