-
- All Implemented Interfaces:
-
android.database.Cursor,java.io.Closeable,java.lang.AutoCloseable
public class MatrixCursor extends AbstractCursor
A mutable cursor implementation backed by an array of
{@code Object}s. Use newRow to add rows. Automatically expands internal capacity as needed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classMatrixCursor.RowBuilderBuilds a row, starting from the left-most column and adding one columnvalue at a time. Follows the same ordering as the column names specifiedat cursor construction time.
-
Field Summary
Fields Modifier and Type Field Description private final Array<String>columnNames
-
Constructor Summary
Constructors Constructor Description MatrixCursor(Array<String> columnNames, int initialCapacity)Constructs a new cursor with the given initial capacity. MatrixCursor(Array<String> columnNames)Constructs a new cursor.
-
Method Summary
Modifier and Type Method Description Array<String>getColumnNames()MatrixCursor.RowBuildernewRow()Adds a new row to the end and returns a builder for that row. voidaddRow(Array<Object> columnValues)Adds a new row to the end with the given column values. voidaddRow(Iterable<out Object> columnValues)Adds a new row to the end with the given column values. voidfillWindow(int position, CursorWindow window)intgetCount()StringgetString(int column)shortgetShort(int column)intgetInt(int column)longgetLong(int column)floatgetFloat(int column)doublegetDouble(int column)intgetType(int column)booleanonMove(int oldPosition, int newPosition)This function is called every time the cursor is successfully scrolledto a new position, giving the subclass a chance to update any state itmay have. booleanisNull(int column)-
Methods inherited from class net.zetetic.database.AbstractCursor
close, copyStringToBuffer, deactivate, getBlob, getColumnCount, getColumnIndex, getColumnIndexOrThrow, getColumnName, getExtras, getNotificationUri, getPosition, getWantsAllOnMoveCalls, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, move, moveToFirst, moveToLast, moveToNext, moveToPosition, moveToPrevious, registerContentObserver, registerDataSetObserver, requery, respond, setExtras, setNotificationUri, unregisterContentObserver, unregisterDataSetObserver -
Methods inherited from class android.database.Cursor
close, copyStringToBuffer, deactivate, getBlob, getColumnCount, getColumnIndex, getColumnIndexOrThrow, getColumnName, getColumnNames, getCount, getDouble, getExtras, getFloat, getInt, getLong, getNotificationUri, getNotificationUris, getPosition, getShort, getString, getType, getWantsAllOnMoveCalls, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, isNull, move, moveToFirst, moveToLast, moveToNext, moveToPosition, moveToPrevious, registerContentObserver, registerDataSetObserver, requery, respond, setExtras, setNotificationUri, setNotificationUris, unregisterContentObserver, unregisterDataSetObserver -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getColumnNames
Array<String> getColumnNames()
-
newRow
MatrixCursor.RowBuilder newRow()
Adds a new row to the end and returns a builder for that row. Not safefor concurrent use.
-
addRow
void addRow(Array<Object> columnValues)
Adds a new row to the end with the given column values. Not safefor concurrent use.
- Parameters:
columnValues- in the same order as the the column names specifiedat cursor construction time
-
addRow
void addRow(Iterable<out Object> columnValues)
Adds a new row to the end with the given column values. Not safefor concurrent use.
- Parameters:
columnValues- in the same order as the the column names specifiedat cursor construction time
-
fillWindow
void fillWindow(int position, CursorWindow window)
-
getCount
int getCount()
-
getShort
short getShort(int column)
-
getInt
int getInt(int column)
-
getLong
long getLong(int column)
-
getFloat
float getFloat(int column)
-
getDouble
double getDouble(int column)
-
getType
int getType(int column)
-
onMove
boolean onMove(int oldPosition, int newPosition)
This function is called every time the cursor is successfully scrolledto a new position, giving the subclass a chance to update any state itmay have. If it returns false the move function will also do so and thecursor will scroll to the beforeFirst position.
This function should be called by methods such as moveToPosition,so it will typically not be called from outside of the cursor class itself.
- Parameters:
oldPosition- The position that we're moving from.newPosition- The position that we're moving to.
-
isNull
boolean isNull(int column)
-
-
-
-