org.h2.mvstore
Class Cursor<K>

java.lang.Object
  extended by org.h2.mvstore.Cursor<K>
Type Parameters:
K - the key type
All Implemented Interfaces:
java.util.Iterator<K>

public class Cursor<K>
extends java.lang.Object
implements java.util.Iterator<K>

A cursor to iterate over elements in ascending order.


Field Summary
protected  K current
           
protected  K from
           
protected  MVMap<K,?> map
           
protected  CursorPos pos
           
 
Constructor Summary
protected Cursor(MVMap<K,?> map, Page root, K from)
           
 
Method Summary
protected  void fetchNext()
          Fetch the next entry if there is one.
 boolean hasNext()
           
protected  void min(Page p, K from)
          Fetch the next entry that is equal or larger than the given key, starting from the given page.
 K next()
           
 void remove()
           
 void skip(long n)
          Skip over that many entries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected final MVMap<K,?> map

from

protected final K from

pos

protected CursorPos pos

current

protected K current
Constructor Detail

Cursor

protected Cursor(MVMap<K,?> map,
                 Page root,
                 K from)
Method Detail

next

public K next()
Specified by:
next in interface java.util.Iterator<K>

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<K>

skip

public void skip(long n)
Skip over that many entries. This method is relatively fast (for this map implementation) even if many entries need to be skipped.

Parameters:
n - the number of entries to skip

remove

public void remove()
Specified by:
remove in interface java.util.Iterator<K>

min

protected void min(Page p,
                   K from)
Fetch the next entry that is equal or larger than the given key, starting from the given page. This method retains the stack.

Parameters:
p - the page to start
from - the key to search

fetchNext

protected void fetchNext()
Fetch the next entry if there is one.