Package org.h2.index

# Class IndexCursor

java.lang.Object
org.h2.index.IndexCursor

All Implemented Interfaces:
  `Cursor`

public class IndexCursor extends Object implements Cursor
The filter used to walk through an index. This class supports IN(..) and IN(SELECT ...) optimizations.

## Constructor Summary

Constructors
Constructor
Description
`IndexCursor()`

## Method Summary

Modifier and Type
Method
Description
`static boolean`
`canUseIndexForIn(Index index, Column[] columns)`
Return `true` if `Index.getIndexColumns()` and the `columns` parameter contains the same elements in the same order.
`void`
`find(SessionLocal s, ArrayList<IndexCondition> indexConditions)`
Re-evaluate the start and end values of the index search for rows.
`Row`
`get()`
Get the complete current row.
`SearchRow`
`getEnd()`
Get end search row.
`SearchRow`
`getSearchRow()`
Get the current row.
`SearchRow`
`getStart()`
Get start search row.
`boolean`
`isAlwaysFalse()`
Check if the result is empty for sure.
`boolean`
`next()`
Skip to the next row if one is available.
`void`
`prepare(SessionLocal s, ArrayList<IndexCondition> indexConditions)`
Prepare this index cursor to make a lookup in index.
`boolean`
`previous()`
Skip to the previous row if one is available.
`void`
`setIndex(Index index, boolean reverse)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### IndexCursor

public IndexCursor()

## Method Details

### setIndex

public void setIndex(Index index, boolean reverse)

### prepare

public void prepare(SessionLocal s, ArrayList<IndexCondition> indexConditions)
Prepare this index cursor to make a lookup in index.

Parameters:
  `s` - Session.
  `indexConditions` - Index conditions.

### find

public void find(SessionLocal s, ArrayList<IndexCondition> indexConditions)
Re-evaluate the start and end values of the index search for rows.

Parameters:
  `s` - the session
  `indexConditions` - the index conditions

### canUseIndexForIn

public static boolean canUseIndexForIn(Index index, Column[] columns)
Return `true` if `Index.getIndexColumns()` and the `columns` parameter contains the same elements in the same order. All column of the index must match the column in the `columns` array, or it must be a VIEW index (where the column is null).

See Also:
  - `IndexCondition.getMask(ArrayList)`

### isAlwaysFalse

public boolean isAlwaysFalse()
Check if the result is empty for sure.

Returns:
  true if it is

### getStart

public SearchRow getStart()
Get start search row.

Returns:
  search row

### getEnd

public SearchRow getEnd()
Get end search row.

Returns:
  search row

### get

public Row get()
Description copied from interface: `Cursor`
Get the complete current row. All column are available.

Specified by:
  `get` in interface `Cursor`
Returns:
  the complete row

### getSearchRow

public SearchRow getSearchRow()
Description copied from interface: `Cursor`
Get the current row. Only the data for indexed columns is available in this row.

Specified by:
  `getSearchRow` in interface `Cursor`
Returns:
  the search row

### next

public boolean next()
Description copied from interface: `Cursor`
Skip to the next row if one is available.

Specified by:
  `next` in interface `Cursor`
Returns:
  true if another row is available

### previous

public boolean previous()
Description copied from interface: `Cursor`
Skip to the previous row if one is available. No filtering is made here.

Specified by:
  `previous` in interface `Cursor`
Returns:
  true if another row is available