Methods Summary |
---|
public void | close()
int length = mCursors.length;
for (int i = 0 ; i < length ; i++) {
if (mCursors[i] == null) continue;
mCursors[i].close();
}
|
public boolean | commitUpdates()
int length = mCursors.length;
for (int i = 0 ; i < length ; i++) {
if (mCursors[i] != null) {
mCursors[i].commitUpdates();
}
}
onChange(true);
return true;
|
public void | deactivate()
int length = mCursors.length;
for (int i = 0 ; i < length ; i++) {
if (mCursors[i] == null) continue;
mCursors[i].deactivate();
}
|
public boolean | deleteRow()
return mCursor.deleteRow();
|
public byte[] | getBlob(int column)
return mCursor.getBlob(column);
|
public java.lang.String[] | getColumnNames()
if (mCursor != null) {
return mCursor.getColumnNames();
} else {
// All of the cursors may be empty, but they can still return
// this information.
int length = mCursors.length;
for (int i = 0 ; i < length ; i++) {
if (mCursors[i] != null) {
return mCursors[i].getColumnNames();
}
}
throw new IllegalStateException("No cursor that can return names");
}
|
public int | getCount()
int count = 0;
int length = mCursors.length;
for (int i = 0 ; i < length ; i++) {
if (mCursors[i] != null) {
count += mCursors[i].getCount();
}
}
return count;
|
public double | getDouble(int column)
return mCursor.getDouble(column);
|
public float | getFloat(int column)
return mCursor.getFloat(column);
|
public int | getInt(int column)
return mCursor.getInt(column);
|
public long | getLong(int column)
return mCursor.getLong(column);
|
public short | getShort(int column)
return mCursor.getShort(column);
|
public java.lang.String | getString(int column)
return mCursor.getString(column);
|
public boolean | isNull(int column)
return mCursor.isNull(column);
|
public boolean | onMove(int oldPosition, int newPosition)
if (oldPosition == newPosition)
return true;
/* Find the right cursor
* Because the client of this cursor (the listadapter/view) tends
* to jump around in the cursor somewhat, a simple cache strategy
* is used to avoid having to search all cursors from the start.
* TODO: investigate strategies for optimizing random access and
* reverse-order access.
*/
int cache_entry = newPosition % ROWCACHESIZE;
if (mRowNumCache[cache_entry] == newPosition) {
int which = mCursorCache[cache_entry];
mCursor = mCursors[which];
if (mCursor == null) {
Log.w(TAG, "onMove: cache results in a null cursor.");
return false;
}
mCursor.moveToPosition(mCurRowNumCache[cache_entry][which]);
mLastCacheHit = cache_entry;
return true;
}
mCursor = null;
int length = mCursors.length;
if (mLastCacheHit >= 0) {
for (int i = 0; i < length; i++) {
if (mCursors[i] == null) continue;
mCursors[i].moveToPosition(mCurRowNumCache[mLastCacheHit][i]);
}
}
if (newPosition < oldPosition || oldPosition == -1) {
for (int i = 0 ; i < length; i++) {
if (mCursors[i] == null) continue;
mCursors[i].moveToFirst();
}
oldPosition = 0;
}
if (oldPosition < 0) {
oldPosition = 0;
}
// search forward to the new position
int smallestIdx = -1;
for(int i = oldPosition; i <= newPosition; i++) {
String smallest = "";
smallestIdx = -1;
for (int j = 0 ; j < length; j++) {
if (mCursors[j] == null || mCursors[j].isAfterLast()) {
continue;
}
String current = mCursors[j].getString(mSortColumns[j]);
if (smallestIdx < 0 || current.compareToIgnoreCase(smallest) < 0) {
smallest = current;
smallestIdx = j;
}
}
if (i == newPosition) break;
if (mCursors[smallestIdx] != null) {
mCursors[smallestIdx].moveToNext();
}
}
mCursor = mCursors[smallestIdx];
mRowNumCache[cache_entry] = newPosition;
mCursorCache[cache_entry] = smallestIdx;
for (int i = 0; i < length; i++) {
if (mCursors[i] != null) {
mCurRowNumCache[cache_entry][i] = mCursors[i].getPosition();
}
}
mLastCacheHit = -1;
return true;
|
public void | registerDataSetObserver(android.database.DataSetObserver observer)
int length = mCursors.length;
for (int i = 0 ; i < length ; i++) {
if (mCursors[i] != null) {
mCursors[i].registerDataSetObserver(observer);
}
}
|
public boolean | requery()
int length = mCursors.length;
for (int i = 0 ; i < length ; i++) {
if (mCursors[i] == null) continue;
if (mCursors[i].requery() == false) {
return false;
}
}
return true;
|
public void | unregisterDataSetObserver(android.database.DataSetObserver observer)
int length = mCursors.length;
for (int i = 0 ; i < length ; i++) {
if (mCursors[i] != null) {
mCursors[i].unregisterDataSetObserver(observer);
}
}
|