|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Cursor<E>
A Cursor for bidirectional traversal over elements in a dataset. Cursors unlike Iterators or Enumerations may advance to an element by calling next() or previous() which returns true or false if the request succeeds with a viable element at the new position. Operations for relative positioning in larger increments are provided. If the cursor can not advance, then the Cursor is either positioned before the first element or after the last element in which case the user of the Cursor must stop advancing in the respective direction. If an advance succeeds a get() operation retreives the current object at the Cursors position. Although this interface presumes Cursors can advance bidirectionally, implementations may restrict this by throwing UnsupportedOperationExceptions.
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 Curser 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 Curser before the first element. |
void |
close()
Closes this Cursor and frees any resources it my have allocated. |
void |
close(java.lang.Exception reason)
Closes this Cursor and frees any resources it my have allocated. |
boolean |
first()
Positions this Curser at the first element. |
E |
get()
Gets the object at the current position. |
boolean |
isClosed()
Checks if this Curser is closed. |
boolean |
isElementReused()
Gets whether or not this Cursor will return the same element object instance on get() operations for any position of this Cursor. |
boolean |
last()
Positions this Curser at the last element. |
boolean |
next()
Advances this Cursor to the next position. |
boolean |
previous()
Advances this Cursor to the previous position. |
void |
setClosureMonitor(ClosureMonitor monitor)
Sets a non-null closure monitor to associate with this Cursor. |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Method Detail |
---|
boolean available()
void before(E element) throws java.lang.Exception
element
- the element to be positioned before
java.lang.Exception
- with problems accessing the underlying btree
java.lang.UnsupportedOperationException
- if this method is not supportedvoid after(E element) throws java.lang.Exception
element
- the element to be positioned after
java.lang.Exception
- if there are problems positioning this cursor or if
this Cursor is closed
java.lang.UnsupportedOperationException
- if this method is not supportedvoid beforeFirst() throws java.lang.Exception
java.lang.Exception
- if there are problems positioning this cursor or if
this Cursor is closed
java.lang.UnsupportedOperationException
- if this method is not supportedvoid afterLast() throws java.lang.Exception
java.lang.Exception
- if there are problems positioning this Cursor or if
this Cursor is closed
java.lang.UnsupportedOperationException
- if this method is not supportedboolean first() throws java.lang.Exception
java.lang.Exception
- if there are problems positioning this Cursor or if
this Cursor is closed
java.lang.UnsupportedOperationException
- if this method is not supportedboolean last() throws java.lang.Exception
java.lang.Exception
- if there are problems positioning this Cursor or if
this Cursor is closed
java.lang.UnsupportedOperationException
- if this method is not supportedboolean isClosed() throws java.lang.Exception
java.lang.Exception
- if there are problems determining the cursor's closed state
java.lang.UnsupportedOperationException
- if this method is not supportedboolean previous() throws java.lang.Exception
java.lang.Exception
- if there are problems advancing to the next position
java.lang.UnsupportedOperationException
- if this method is not supportedboolean next() throws java.lang.Exception
java.lang.Exception
- if there are problems advancing to this Cursor to
the next position, or if this Cursor is closed
java.lang.UnsupportedOperationException
- if this method is not supportedE get() throws java.lang.Exception
java.lang.Exception
- if the object at this Cursor's current position
cannot be retrieved, or if this Cursor is closedboolean isElementReused()
void close() throws java.lang.Exception
java.lang.Exception
- if for some reason this Cursor could not be closedvoid close(java.lang.Exception reason) throws java.lang.Exception
reason
- exception thrown when this Cursor is accessed after close
java.lang.Exception
- if for some reason this Cursor could not be closedvoid setClosureMonitor(ClosureMonitor monitor)
monitor
- the monitor to use for detecting Cursor close events
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |