|
16 | 16 |
|
17 | 17 | package android.database; |
18 | 18 |
|
| 19 | +/** |
| 20 | + * A cross process cursor is an extension of a {@link Cursor} that also supports |
| 21 | + * usage from remote processes. |
| 22 | + * <p> |
| 23 | + * The contents of a cross process cursor are marshalled to the remote process by |
| 24 | + * filling {@link CursorWindow} objects using {@link #fillWindow}. As an optimization, |
| 25 | + * the cursor can provide a pre-filled window to use via {@link #getWindow} thereby |
| 26 | + * obviating the need to copy the data to yet another cursor window. |
| 27 | + */ |
19 | 28 | public interface CrossProcessCursor extends Cursor { |
20 | 29 | /** |
21 | | - * returns a pre-filled window, return NULL if no such window |
| 30 | + * Returns a pre-filled window that contains the data within this cursor. |
| 31 | + * <p> |
| 32 | + * In particular, the window contains the row indicated by {@link Cursor#getPosition}. |
| 33 | + * The window's contents are automatically scrolled whenever the current |
| 34 | + * row moved outside the range covered by the window. |
| 35 | + * </p> |
| 36 | + * |
| 37 | + * @return The pre-filled window, or null if none. |
22 | 38 | */ |
23 | 39 | CursorWindow getWindow(); |
24 | 40 |
|
25 | 41 | /** |
26 | | - * copies cursor data into the window start at pos |
| 42 | + * Copies cursor data into the window. |
| 43 | + * <p> |
| 44 | + * Clears the window and fills it with data beginning at the requested |
| 45 | + * row position until all of the data in the cursor is exhausted |
| 46 | + * or the window runs out of space. |
| 47 | + * </p><p> |
| 48 | + * The filled window uses the same row indices as the original cursor. |
| 49 | + * For example, if you fill a window starting from row 5 from the cursor, |
| 50 | + * you can query the contents of row 5 from the window just by asking it |
| 51 | + * for row 5 because there is a direct correspondence between the row indices |
| 52 | + * used by the cursor and the window. |
| 53 | + * </p><p> |
| 54 | + * The current position of the cursor, as returned by {@link #getPosition}, |
| 55 | + * is not changed by this method. |
| 56 | + * </p> |
| 57 | + * |
| 58 | + * @param position The zero-based index of the first row to copy into the window. |
| 59 | + * @param window The window to fill. |
27 | 60 | */ |
28 | | - void fillWindow(int pos, CursorWindow winow); |
| 61 | + void fillWindow(int position, CursorWindow window); |
29 | 62 |
|
30 | 63 | /** |
31 | 64 | * This function is called every time the cursor is successfully scrolled |
32 | 65 | * to a new position, giving the subclass a chance to update any state it |
33 | | - * may have. If it returns false the move function will also do so and the |
| 66 | + * may have. If it returns false the move function will also do so and the |
34 | 67 | * cursor will scroll to the beforeFirst position. |
| 68 | + * <p> |
| 69 | + * This function should be called by methods such as {@link #moveToPosition(int)}, |
| 70 | + * so it will typically not be called from outside of the cursor class itself. |
| 71 | + * </p> |
35 | 72 | * |
36 | | - * @param oldPosition the position that we're moving from |
37 | | - * @param newPosition the position that we're moving to |
38 | | - * @return true if the move is successful, false otherwise |
| 73 | + * @param oldPosition The position that we're moving from. |
| 74 | + * @param newPosition The position that we're moving to. |
| 75 | + * @return True if the move is successful, false otherwise. |
39 | 76 | */ |
40 | 77 | boolean onMove(int oldPosition, int newPosition); |
41 | | - |
42 | 78 | } |
0 commit comments