Hi there everyone,
I have sent some emails about cleaning up the IIndexCursor interface, its 
implementations and their usages. Today, that change went in...

What you should know. The interface:

/**
 * Represents an index cursor. The expected use
 *
 * cursor = new cursor();
 * try{
 *  while (more predicates){
 *   cursor.open(predicate);
 *   try{
 *    while (cursor.hasNext()){
 *     cursor.next()
 *    }
 *   } finally{
 *    cursor.close();
 *   }
 *  }
 * } finally{
 *  cursor.destroy();
 * }
 * 
 * Each created cursor must have destroy called
 * Each successfully opened cursor must have close called
 *
 * A cursor is a state machine that works as follows:
 * The states are:
 * <ul>
 * <li>CLOSED</li>
 * <li>OPENED</li>
 * <li>DESTROYED</li>
 * </ul>
 * When a cursor object is created, it is in the CLOSED state.
 * CLOSED: Legal calls are open() --> OPENED, or destroy() --> DESTROYED, 
close() --> no effect
 * OPENED: The only legal calls are hasNext(), next(), or close() --> CLOSED.
 * DESTROYED: The only legal call is destroy() which has no effect.
 *
 * Each cursor must enforce the cursor state machine
 */

All current implementations extends EnforcedIndexCursor which enforces this 
contract and test cases have been added to ensure this is maintained.
If you see any issue in the next few days and you suspect that it is caused by 
this change, let me know and I will take a look.

Apologies in advance for big rebases and thanks a lot,
Abdullah.

Reply via email to