public class DefaultBiIndexImpl<KeyType,ValueType> extends DefaultIndexImpl<KeyType,ValueType> implements HGBidirectionalIndex<KeyType,ValueType>
comparator, cursorConfig, db, DB_NAME_PREFIX, keyConverter, name, sort_duplicates, storage, transactionManager, valueConverter
Constructor and Description |
---|
DefaultBiIndexImpl(java.lang.String indexName,
BJEStorageImplementation storage,
HGTransactionManager transactionManager,
ByteArrayConverter<KeyType> keyConverter,
ByteArrayConverter<ValueType> valueConverter,
java.util.Comparator<?> comparator) |
Modifier and Type | Method and Description |
---|---|
void |
addEntry(KeyType key,
ValueType value)
Add an entry to the index.
|
void |
close()
Close this index.
|
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. |
boolean |
isOpen()
Return
true if the index is currently opened and
false otherwise. |
void |
open()
Open the index for use.
|
checkOpen, count, count, finalize, find, findFirst, findGT, findGTE, findLast, findLT, findLTE, getComparator, getData, getDatabaseName, getName, removeAllEntries, removeEntry, scanKeys, scanValues, txn
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
count, count, find, findFirst, getName, removeAllEntries, removeEntry, scanKeys, scanValues
public DefaultBiIndexImpl(java.lang.String indexName, BJEStorageImplementation storage, HGTransactionManager transactionManager, ByteArrayConverter<KeyType> keyConverter, ByteArrayConverter<ValueType> valueConverter, java.util.Comparator<?> comparator)
public void open()
HGIndex
Open the index for use. Entries may be added to the index only when it
has been explicitly opened. To determine whether an index is currently
opened, use the isOpen
method. Note that an index may be
temporarily opened by the HyperGraph querying mechanism.
public void close()
HGIndex
Close this index. This method closes any run-time resources associated with the index, and invalidates it for use until reopened. It does not remove the index permanently from the database.
public boolean isOpen()
HGIndex
Return true
if the index is currently opened and
false
otherwise.
public void addEntry(KeyType key, ValueType value)
HGIndex
Add an entry to the index. If that entry is already present, calling this method should have no effect.
public HGRandomAccessResult<KeyType> findByValue(ValueType value)
HGBidirectionalIndex
Return a HGSearchResult
over all keys whose
value is the value
parameter.
findByValue
in interface HGBidirectionalIndex<KeyType,ValueType>
public KeyType findFirstByValue(ValueType value)
HGBidirectionalIndex
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.
findFirstByValue
in interface HGBidirectionalIndex<KeyType,ValueType>
public long countKeys(ValueType value)
HGBidirectionalIndex
Return the number of keys pointing to the given values. This operation must execute in constant time, regardless of the data in the index.
countKeys
in interface HGBidirectionalIndex<KeyType,ValueType>
value
- The value.