net.obsearch.storage.tc
Class AbstractTCOBStorage.CursorIterator<T>

java.lang.Object
  extended by net.obsearch.storage.tc.AbstractTCOBStorage.CursorIterator<T>
Type Parameters:
O - The type of tuple that will be returned by the iterator.
All Implemented Interfaces:
Iterator<T>, CloseIterator<T>
Direct Known Subclasses:
AbstractTCOBStorage.ByteArrayIterator, AbstractTCOBStorage.ByteArrayKeyIterator
Enclosing class:
AbstractTCOBStorage<T extends Tuple>

protected abstract class AbstractTCOBStorage.CursorIterator<T>
extends Object
implements CloseIterator<T>

Base class used to iterate over cursors. Only supports full search


Field Summary
protected  byte[] lastReturnedKey
           
protected  byte[] nextKey
           
protected  byte[] nextValue
           
 
Constructor Summary
protected AbstractTCOBStorage.CursorIterator()
           
 
Method Summary
 void closeCursor()
           
protected  T createT(byte[] key, byte[] value)
           
protected abstract  T createTuple(byte[] key, byte[] value)
          Creates a tuple from the given key and value.
 boolean hasNext()
           
protected  void loadNext()
          Loads data from keyEntry and dataEntry and puts it into next.
 T next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nextKey

protected byte[] nextKey

nextValue

protected byte[] nextValue

lastReturnedKey

protected byte[] lastReturnedKey
Constructor Detail

AbstractTCOBStorage.CursorIterator

protected AbstractTCOBStorage.CursorIterator()
                                      throws OBStorageException
Throws:
OBStorageException
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<T>

loadNext

protected void loadNext()
                 throws NoSuchElementException
Loads data from keyEntry and dataEntry and puts it into next. If we go beyond max, we set next to null so that everybody will work properly.

Throws:
NoSuchElementException

createT

protected T createT(byte[] key,
                    byte[] value)

createTuple

protected abstract T createTuple(byte[] key,
                                 byte[] value)
Creates a tuple from the given key and value.

Parameters:
key - raw key.
value - raw value.
Returns:
A new tuple of type T created from the raw data key and value.

next

public T next()
Specified by:
next in interface Iterator<T>

closeCursor

public void closeCursor()
                 throws OBException
Specified by:
closeCursor in interface CloseIterator<T>
Throws:
OBException

remove

public void remove()
Specified by:
remove in interface Iterator<T>


Copyright © 2007-2011 Arnoldo Jose Muller Molina. All Rights Reserved.