org.hypergraphdb
Interface HGBidirectionalIndex<KeyType,ValueType>

All Superinterfaces:
HGIndex<KeyType,ValueType>, HGSearchable<KeyType,ValueType>
All Known Implementing Classes:
DefaultBiIndexImpl

public interface HGBidirectionalIndex<KeyType,ValueType>
extends HGIndex<KeyType,ValueType>

A HGBidirectionalIndex provides efficient searching of an index entry by value as well as by key. It can be used as an efficient associative array between keys and values.

Author:
Borislav Iordanov

Method Summary
 long countKeys(ValueType value)
          Return the number of keys pointing to the given values.
 HGRandomAccessResult<KeyType> findByValue(ValueType value)
          Return a HGSearchResult over all keys whose value is the value parameter.
 KeyType findFirstByValue(ValueType value)
          Return a key whose value is the value parameter.
 
Methods inherited from interface org.hypergraphdb.HGIndex
addEntry, close, count, count, find, findFirst, isOpen, open, removeAllEntries, removeEntry, scanKeys, scanValues
 

Method Detail

findByValue

HGRandomAccessResult<KeyType> findByValue(ValueType value)

Return a HGSearchResult over all keys whose value is the value parameter.


findFirstByValue

KeyType findFirstByValue(ValueType value)

Return a key whose value is the value parameter. If more than one index entry exists with that particular value, generally the one that was added first will be returned, but this is not guarantueed.


countKeys

long countKeys(ValueType value)

Return the number of keys pointing to the given values. This operation must execute in constant time, regardless of the data in the index.

Parameters:
value - The value.