com.wm.data
Interface IDataIndexCursor

All Superinterfaces:
IDataCursor

public interface IDataIndexCursor
extends IDataCursor

This interface defines methods you can use to traverse an IData object's elements by absolute position. It is returned by an IData object's getIndexCursor method.


This cursor class has been deprecated. To position a cursor at a specific index, you may loop to that index using the next method in the IDataCursor class. The following is a simple example.

  //---This method finds the Nth element and returns null if there is no element N.
       Object getElement(int n, IData data)
       {
           IDataCursor cur = data.getCursor();
           int i = 0;
           while (cur.next())
           {
           if (i == n)
               break;
           i++;
           }
           return cur.getValue();
       }

Note: The contents of an IData object is not necessarily synchronized, so information, such as the value returned by count, might not be accurate if multiple cursors modify a single IData.

See Also:
IData, IDataFactory, IDataCursor, IDataHashCursor, IDataTreeCursor

Method Summary
 int count()
          Deprecated. Replaced by IDataUtil.size(IDataCursor).
 boolean seek(int index)
          Deprecated. No replacement.
 
Methods inherited from interface com.wm.data.IDataCursor
delete, destroy, first, first, getCursorClone, getKey, getLastError, getValue, hasMoreData, hasMoreErrors, insertAfter, insertBefore, insertDataAfter, insertDataBefore, last, last, next, next, previous, previous, setErrorMode, setKey, setValue
 

Method Detail

seek

boolean seek(int index)
Deprecated. No replacement.

Moves the cursor position to the specified index. If the specified index does not contain a key/value pair, seek returns false.

Parameters:
index - an int specifying the index to which you want the cursor moved. The first entry in an IData object is index 0.
Returns:
true if the cursor was moved; false otherwise.

count

int count()
Deprecated. Replaced by IDataUtil.size(IDataCursor).

Counts the number of top-level key/value entries in this IData object. It is not necessary to initialize the cursor position before calling this method; however, you should perform all insertions and deletions with a single cursor to get correct results.

Returns:
An int indicating the number of top-level key/value entries in this IData object. If the IData does not contain any key/value entries, count returns 0.