com.wm.data
Interface IDataTreeCursor

All Superinterfaces:
IDataCursor

public interface IDataTreeCursor
extends IDataCursor

This cursor class has been deprecated. To position a cursor by key, use the key-based methods in the IDataCursor or IDataSharedCursor classes.

This interface defines methods you can use to traverse a tree of IData objects. It is returned by an IData object's getTreeCursor method.

Because this interface extends IDataCursor, you can also use the methods from that interface to access, traverse, and manipulate the IData object--you may arbitrarily mix the methods in IDataTreeCursor and IDataCursor as needed. For example, you might use IDataCursor.last to position the cursor at the last name/value pair in the object and then use IDataHashTreeCursor.down method to move into the nested IData object.

If you write a class that implements the IData interface, that class must support the getTreeCursor method and that method must return a class that implements this interface.

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

The following is an example of how a this interface might be used to navigate an IData object. In this example, every one of the println messages will display "true":

      IData id = IDataFactory.create();
      IData idChild1 = IDataFactory.create();
      IDataCursor idcChild1 = idChild1.getCursor();
      idcChild1.insertAfter("s", "s1");
      idcChild1.destroy();

      IDataTreeCursor idtc = id.getTreeCursor();
      idtc.insertAfter("a", "a1");
      idtc.insertAfter("child1", idChild1);
      idtc.first();

   // can’t move up, because there is no parent to this IData.
   // the parent had to be walked through with a down().
      System.out.println("TreeCursor up(false) "+ !idtc.up());

   // can’t move down, because the current value is not an IData.
      System.out.println( "TreeCursor down(false)" + !idtc.down());

   // move to the second name/value pair, which does have an IData value
      System.out.println( "TreeCursor next(true) "+ idtc.next());

   // can move down, because the current value is an IData.
      System.out.println("TreeCursor down(true) "+ idtc.down());

      String key;
      System.out.println("TreeCursor first() of child "+ idtc.first());
      key = idtc.getKey();
      System.out.println("TreeCursor getKey():'"+key+"'");
      if( key!=null )
          if ( key.equals("s")) System.out.println("TreeCursor getKey('s')");

See Also:
IData, IDataFactory, IDataCursor, IDataHashCursor

Method Summary
 boolean down()
          Deprecated. No replacement.
 boolean up()
          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

up

boolean up()
Deprecated. No replacement.

Moves the cursor position back into a parent IData.

Returns:
true if there was a parent IData to move to; false otherwise.

down

boolean down()
Deprecated. No replacement.

Moves the cursor position into the nested IData object.

Returns:
true if the value of the current name/value pair was an IData object ; false otherwise.