org.apache.directory.shared.ldap.model.cursor
Class EmptyCursor<E>

java.lang.Object
  extended by org.apache.directory.shared.ldap.model.cursor.AbstractCursor<E>
      extended by org.apache.directory.shared.ldap.model.cursor.EmptyCursor<E>
Type Parameters:
E - The type of element on which this cursor will iterate
All Implemented Interfaces:
Iterable<E>, Cursor<E>

public class EmptyCursor<E>
extends AbstractCursor<E>

An empty Cursor implementation.

Author:
Apache Directory Project

Constructor Summary
EmptyCursor()
           
 
Method Summary
 void after(E element)
          Prepares this Cursor, so a subsequent call to Cursor#previous() with a true return value, will have positioned the Cursor on a dataSet element equal to or less than the element argument but not greater.
 void afterLast()
          Positions this Cursor after the last element.
 boolean available()
          Determines whether or not a call to get() will succeed.
 void before(E element)
          Prepares this Cursor, so a subsequent call to Cursor#next() with a true return value, will have positioned the Cursor on a dataSet element equal to or less than the element argument but not greater.
 void beforeFirst()
          Positions this Cursor before the first element.
 boolean first()
          Positions this Cursor at the first element.
 E get()
          Gets the object at the current position.
 boolean last()
          Positions this Cursor at the last element.
 boolean next()
          Advances this Cursor to the next position.
 boolean previous()
          Advances this Cursor to the previous position.
 
Methods inherited from class org.apache.directory.shared.ldap.model.cursor.AbstractCursor
checkNotClosed, close, close, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, iterator, setClosureMonitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmptyCursor

public EmptyCursor()
Method Detail

available

public boolean available()
Determines whether or not a call to get() will succeed.

Returns:
true if a call to the get() method will succeed, false otherwise

before

public void before(E element)
            throws Exception
Prepares this Cursor, so a subsequent call to Cursor#next() with a true return value, will have positioned the Cursor on a dataSet element equal to or less than the element argument but not greater. A call to Cursor#previous() with a true return value will position the Cursor on a dataSet element less than the argument. If Cursor#next() returns false then the Cursor is past the last element and so all values in the dataSet are less than the argument. If Cursor#previous() returns false then the Cursor is positioned before the first element and all elements in the dataSet are greater than the argument.

Parameters:
element - the element to be positioned before
Throws:
Exception - with problems accessing the underlying btree

after

public void after(E element)
           throws Exception
Prepares this Cursor, so a subsequent call to Cursor#previous() with a true return value, will have positioned the Cursor on a dataSet element equal to or less than the element argument but not greater. A call to Cursor#next() with a true return value will position the Cursor on a dataSet element greater than the argument. If Cursor#next() returns false then the Cursor is past the last element and so all values in the dataSet are less than or equal to the argument. If Cursor#previous() returns false then the Cursor is positioned before the first element and all elements in the dataSet are greater than the argument.

Parameters:
element - the element to be positioned after
Throws:
Exception - if there are problems positioning this cursor or if this Cursor is closed

beforeFirst

public void beforeFirst()
                 throws Exception
Positions this Cursor before the first element.

Throws:
Exception - if there are problems positioning this cursor or if this Cursor is closed

afterLast

public void afterLast()
               throws Exception
Positions this Cursor after the last element.

Throws:
Exception - if there are problems positioning this Cursor or if this Cursor is closed

first

public boolean first()
              throws Exception
Positions this Cursor at the first element.

Returns:
true if the position has been successfully changed to the first element, false otherwise
Throws:
Exception - if there are problems positioning this Cursor or if this Cursor is closed

last

public boolean last()
             throws Exception
Positions this Cursor at the last element.

Returns:
true if the position has been successfully changed to the last element, false otherwise
Throws:
Exception - if there are problems positioning this Cursor or if this Cursor is closed

previous

public boolean previous()
                 throws Exception
Advances this Cursor to the previous position. If called before explicitly positioning this Cursor, the position is presumed to be after the last element and this method moves the cursor back to the last element.

Returns:
true if the advance succeeded, false otherwise
Throws:
Exception - if there are problems advancing to the next position

next

public boolean next()
             throws Exception
Advances this Cursor to the next position. If called before explicitly positioning this Cursor, the position is presumed to be before the first element and this method moves the cursor forward to the first element.

Returns:
true if the advance succeeded, false otherwise
Throws:
Exception - if there are problems advancing to this Cursor to the next position, or if this Cursor is closed

get

public E get()
      throws Exception
Gets the object at the current position. Cursor implementations may choose to reuse element objects by re-populating them on advances instead of creating new objects on each advance.

Returns:
the object at the current position
Throws:
Exception - if the object at this Cursor's current position cannot be retrieved, or if this Cursor is closed


Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.