| 1 |
/* |
| 2 |
* Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, |
| 3 |
* and the EPL 1.0 (https://h2database.com/html/license.html). |
| 4 |
* Initial Developer: H2 Group |
| 5 |
*/ |
| 6 |
package org.h2.index; |
| 7 |
|
| 8 |
import org.h2.result.Row; |
| 9 |
import org.h2.result.SearchRow; |
| 10 |
|
| 11 |
/** |
| 12 |
* A cursor is a helper object to iterate through an index. |
| 13 |
* For indexes are sorted (such as the b tree index), it can iterate |
| 14 |
* to the very end of the index. For other indexes that don't support |
| 15 |
* that (such as a hash index), only one row is returned. |
| 16 |
* The cursor is initially positioned before the first row, that means |
| 17 |
* next() must be called before accessing data. |
| 18 |
* |
| 19 |
*/ |
| 20 |
public interface Cursor { |
| 21 |
|
| 22 |
/** |
| 23 |
* Get the complete current row. |
| 24 |
* All column are available. |
| 25 |
* |
| 26 |
* @return the complete row |
| 27 |
*/ |
| 28 |
Row get(); |
| 29 |
|
| 30 |
/** |
| 31 |
* Get the current row. |
| 32 |
* Only the data for indexed columns is available in this row. |
| 33 |
* |
| 34 |
* @return the search row |
| 35 |
*/ |
| 36 |
SearchRow getSearchRow(); |
| 37 |
|
| 38 |
/** |
| 39 |
* Skip to the next row if one is available. |
| 40 |
* |
| 41 |
* @return true if another row is available |
| 42 |
*/ |
| 43 |
boolean next(); |
| 44 |
|
| 45 |
/** |
| 46 |
* Skip to the previous row if one is available. |
| 47 |
* No filtering is made here. |
| 48 |
* |
| 49 |
* @return true if another row is available |
| 50 |
*/ |
| 51 |
boolean previous(); |
| 52 |
|
| 53 |
} |