org.apache.directory.mavibot.btree

## Class KeyCursor<K>

- java.lang.Object
- - org.apache.directory.mavibot.btree.KeyCursor<K>

- Type Parameters:
    `K` - The type for the Key

      public class KeyCursor<K>
      extends Object

  A Cursor is used to fetch only keys in a BTree and is returned by the
  Author:
    Apache Directory Project
  See Also:
    `method. The cursor must be closed when the user is done with it.

    `

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `depth` The stack's depth
    `protected org.apache.directory.mavibot.btree.ParentPos<K,K>[]` | `stack` The stack of pages from the root down to the leaf
    `protected ReadTransaction<K,K>` | `transaction` The transaction used for this cursor

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `KeyCursor()` Creates a new instance of Cursor.
    `` | `KeyCursor(ReadTransaction<K,K> transaction, org.apache.directory.mavibot.btree.ParentPos<K,K>[] stack, int depth)` Creates a new instance of Cursor, starting on a page at a given position.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterLast()` Change the position in the current cursor to set it after the last key
    `void` | `beforeFirst()` Change the position in the current cursor before the first key
    `void` | `close()`
    `long` | `getCreationDate()` Get the creation date
    `long` | `getRevision()` Get the current revision
    `boolean` | `hasNext()` Tells if the cursor can return a next element
    `boolean` | `hasNextKey()` Tells if the cursor can return a next key
    `boolean` | `hasPrev()` Tells if the cursor can return a previous element
    `boolean` | `hasPrevKey()` Tells if the cursor can return a previous key
    `K` | `next()` Find the next key
    `K` | `nextKey()` Get the next key.
    `K` | `prev()` Find the previous key
    `K` | `prevKey()` Get the previous key.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### stack

          protected org.apache.directory.mavibot.btree.ParentPos<K,K>[] stack

      The stack of pages from the root down to the leaf

    - #### depth

          protected int depth

      The stack's depth

    - #### transaction

          protected ReadTransaction<K,K> transaction

      The transaction used for this cursor

  - ### Constructor Detail

    - #### KeyCursor

          protected KeyCursor()

      Creates a new instance of Cursor.

    - #### KeyCursor

          public KeyCursor(ReadTransaction<K,K> transaction,
                   org.apache.directory.mavibot.btree.ParentPos<K,K>[] stack,
                   int depth)

      Creates a new instance of Cursor, starting on a page at a given position.
      Parameters:
        `transaction` - The transaction this operation is protected by
        `stack` - The stack of parent's from root to this page

  - ### Method Detail

    - #### afterLast

          public void afterLast()
                         throws IOException

      Change the position in the current cursor to set it after the last key
      Throws:
        `IOException`

    - #### beforeFirst

          public void beforeFirst()
                           throws IOException

      Change the position in the current cursor before the first key
      Throws:
        `IOException`

    - #### hasNext

          public boolean hasNext()
                          throws EndOfFileExceededException,
                                 IOException

      Tells if the cursor can return a next element
      Returns:
        true if there are some more elements
      Throws:
        `IOException`
        `EndOfFileExceededException`

    - #### next

          public K next()
                 throws EndOfFileExceededException,
                        IOException

      Find the next key
      Returns:
        the found key
      Throws:
        `IOException`
        `EndOfFileExceededException`

    - #### nextKey

          public K nextKey()
                    throws EndOfFileExceededException,
                           IOException

      Get the next key.
      Throws:
        `EndOfFileExceededException`
        `IOException`

    - #### hasNextKey

          public boolean hasNextKey()
                             throws EndOfFileExceededException,
                                    IOException

      Tells if the cursor can return a next key
      Returns:
        true if there are some more keys
      Throws:
        `IOException`
        `EndOfFileExceededException`

    - #### hasPrev

          public boolean hasPrev()
                          throws EndOfFileExceededException,
                                 IOException

      Tells if the cursor can return a previous element
      Returns:
        true if there are some more elements
      Throws:
        `IOException`
        `EndOfFileExceededException`

    - #### prev

          public K prev()
                 throws EndOfFileExceededException,
                        IOException

      Find the previous key
      Returns:
        the found key
      Throws:
        `IOException`
        `EndOfFileExceededException`

    - #### prevKey

          public K prevKey()
                    throws EndOfFileExceededException,
                           IOException

      Get the previous key.
      Returns:
        the found key
      Throws:
        `EndOfFileExceededException`
        `IOException`

    - #### hasPrevKey

          public boolean hasPrevKey()
                             throws EndOfFileExceededException,
                                    IOException

      Tells if the cursor can return a previous key
      Returns:
        true if there are some more keys
      Throws:
        `IOException`
        `EndOfFileExceededException`

    - #### close

          public void close()

    - #### getCreationDate

          public long getCreationDate()

      Get the creation date
      Returns:
        The creation date for this cursor

    - #### getRevision

          public long getRevision()

      Get the current revision
      Returns:
        The revision this cursor is based on

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2012–2015 Apache Mavibot Project Parent. All rights reserved.