public interface

Cursor

implements Row
com.neomades.database.Cursor

Class Overview

This interface provides random read-write access to the result set returned by a database query. Cursor implementations are not required to be synchronized so code using a Cursor from multiple threads should perform its own synchronization when using the Cursor.

Summary

[Expand]
Inherited Constants
From interface com.neomades.database.ColumnType
Public Methods
abstract void close()
Closes the Cursor, releasing all of its resources and making it completely invalid.
abstract int getCount()
Gets the number of rows in the cursor.
abstract Database getDatabase()
Gets the database that this cursor is associated with.
abstract boolean move(int offset)
Moves the cursor by a relative amount, forward or backward, from the current position.
abstract boolean moveToFirst()
Moves the cursor to the first row.
abstract boolean moveToLast()
Moves the cursor to the last row.
abstract boolean moveToNext()
Moves the cursor to the next row.
abstract boolean moveToPosition(int row)
Moves the cursor to an absolute position.
abstract boolean moveToPrevious()
Move the cursor to the previous row.
[Expand]
Inherited Methods
From interface com.neomades.database.Row

Public Methods

public abstract void close ()

Closes the Cursor, releasing all of its resources and making it completely invalid.

public abstract int getCount ()

Gets the number of rows in the cursor.

Returns
  • number of rows

public abstract Database getDatabase ()

Gets the database that this cursor is associated with.

Returns
  • the Database that this cursor is associated with.

public abstract boolean move (int offset)

Moves the cursor by a relative amount, forward or backward, from the current position.

Positive offsets move forwards, negative offsets move backwards. If the final position is outside of the bounds of the result set then the resultant position will be pinned to -1 or count() depending on whether the value is off the front or end of the set, respectively.

This method will return true if the requested destination was reachable, otherwise, it returns false. For example, if the cursor is at currently on the second entry in the result set and move(-5) is called, the position will be pinned at -1, and false will be returned.

Parameters
offset the offset to be applied from the current position.
Returns
  • whether the requested move fully succeeded.

public abstract boolean moveToFirst ()

Moves the cursor to the first row.

This method will return false if the cursor is empty.

Returns
  • whether the move succeeded.

public abstract boolean moveToLast ()

Moves the cursor to the last row.

This method will return false if the cursor is empty.

Returns
  • whether the move succeeded.

public abstract boolean moveToNext ()

Moves the cursor to the next row.

This method will return false if the cursor is empty.

Returns
  • whether the move succeeded.

public abstract boolean moveToPosition (int row)

Moves the cursor to an absolute position.

The valid range of values is -1 <= position <= count.

This method will return true if the request destination was reachable, otherwise, it returns false.

Parameters
row the zero-based position to move to.
Returns
  • whether the requested move fully succeeded.

public abstract boolean moveToPrevious ()

Move the cursor to the previous row.

This method will return false if the cursor is empty.

Returns
  • whether the move succeeded.