int find(RowCursor cursor)
  {
    int rowOffset = _rowHead;
    int sortOffset = _rowSortHead;
    int rowLength = cursor.length();
    
    int removeLength = cursor.removeLength();
    
    byte []buffer = _buffer;

    while (rowOffset < sortOffset) {
      int code = buffer[rowOffset] & CODE_MASK;

      switch (code) {
      case INSERT:
        if (cursor.compareKeyRow(buffer, rowOffset) == 0) {
          return rowOffset;
        }
        else {
          rowOffset += rowLength;
          break;
        }
        
      case INSERT_DEAD:
        rowOffset += rowLength;
        break;
        
      case REMOVE:
        if (cursor.compareKeyRemove(buffer, rowOffset) == 0) {
          // return PageLeafImpl.INDEX_REMOVED;
          return rowOffset;
        }
        else {
          rowOffset += removeLength;
          break;
        }
        
      default:
        throw new IllegalStateException(L.l("Corrupted block {0} offset {1} code {2}\n",
                                            this, rowOffset, code));
      }
    }
    
    if (sortOffset < BLOCK_SIZE) {
      return findSorted(cursor);
    }
    
    return PageLeafImpl.INDEX_UNMATCH;
  }
int find ( RowCursor cursor ) { int rowOffset = _rowHead ; int sortOffset = _rowSortHead ; int rowLength = cursor . length ( ) ; int removeLength = cursor . removeLength ( ) ; byte [ ] buffer = _buffer ; while ( rowOffset < sortOffset ) { int code = buffer [ rowOffset ] & CODE_MASK ; switch ( code ) { case INSERT : if ( cursor . compareKeyRow ( buffer , rowOffset ) == 0 ) { return rowOffset ; } else { rowOffset += rowLength ; break ; } case INSERT_DEAD : rowOffset += rowLength ; break ; case REMOVE : if ( cursor . compareKeyRemove ( buffer , rowOffset ) == 0 ) { return rowOffset ; } else { rowOffset += removeLength ; break ; } default : throw new IllegalStateException ( L . l ( "Corrupted block {0} offset {1} code {2}\n" , this , rowOffset , code ) ) ; } } if ( sortOffset < BLOCK_SIZE ) { return findSorted ( cursor ) ; } return PageLeafImpl . INDEX_UNMATCH ; }
Searches for a row matching the cursor's key.