org.hypergraphdb.storage
Class SingleValueResultSet<T>

java.lang.Object
  extended by org.hypergraphdb.storage.IndexResultSet<T>
      extended by org.hypergraphdb.storage.SingleValueResultSet<T>
All Implemented Interfaces:
java.util.Iterator<T>, HGRandomAccessResult<T>, HGSearchResult<T>, TwoWayIterator<T>, CloseMe

public class SingleValueResultSet<T>
extends IndexResultSet<T>

A result set based on a BerkeleyDB secondary cursor. That is, when a BerkeleyDB has a secondary DB, it is possible to use the keys of the secondary DB to get primary key and data of the primary DB. This result set returns primary keys based on secondary keys and it ignores the data (which usually will simply be the same thing as the secondary key).

Author:
Borislav Iordanov

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.hypergraphdb.HGRandomAccessResult
HGRandomAccessResult.GotoResult
 
Field Summary
 
Fields inherited from interface org.hypergraphdb.HGSearchResult
EMPTY
 
Constructor Summary
SingleValueResultSet(BDBTxCursor cursor, com.sleepycat.db.DatabaseEntry keyIn, ByteArrayConverter<T> converter)
           
 
Method Summary
 HGRandomAccessResult.GotoResult goTo(T value, boolean exactMatch)
          Position the result set at a particular value if that value is indeed part of the result set.
 boolean isOrdered()
          Return true if the elements in this search result are in ordered and false otherwise.
 
Methods inherited from class org.hypergraphdb.storage.IndexResultSet
close, count, current, hasNext, hasPrev, next, prev, remove, removeCurrent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleValueResultSet

public SingleValueResultSet(BDBTxCursor cursor,
                            com.sleepycat.db.DatabaseEntry keyIn,
                            ByteArrayConverter<T> converter)
Method Detail

goTo

public HGRandomAccessResult.GotoResult goTo(T value,
                                            boolean exactMatch)
Description copied from interface: HGRandomAccessResult

Position the result set at a particular value if that value is indeed part of the result set.

Specified by:
goTo in interface HGRandomAccessResult<T>
Overrides:
goTo in class IndexResultSet<T>
Parameters:
value - The value where this result set should be positioned.
exactMatch - A flag indicating whether the passed in value should match exactly a value in the result set, or whether the cursor should be positioned to the closest value. Here "closest" means "smallest greater than the value parameter.
Returns:
A GotoResult.

isOrdered

public boolean isOrdered()
Description copied from interface: HGSearchResult

Return true if the elements in this search result are in ordered and false otherwise. It is assumed that when elements are ordered, they are instances of java.lang.Comparable