|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hypergraphdb.storage.DefaultIndexImpl<KeyType,ValueType>
public class DefaultIndexImpl<KeyType,ValueType>
A default index implementation. This implementation works by maintaining
a separate DB, using a B-tree, byte [] lexicographical ordering
on its keys. The keys are therefore assumed to by byte []
instances.
| Field Summary | |
|---|---|
static java.lang.String |
DB_NAME_PREFIX
Prefix of HyperGraph index DB filenames. |
| Constructor Summary | |
|---|---|
DefaultIndexImpl(java.lang.String indexName,
com.sleepycat.db.Environment env,
HGTransactionManager transactionManager,
ByteArrayConverter<KeyType> keyConverter,
ByteArrayConverter<ValueType> valueConverter,
java.util.Comparator comparator)
|
|
| Method Summary | |
|---|---|
void |
addEntry(KeyType key,
ValueType value)
Add an entry to the index. |
void |
close()
Close this index. |
long |
count()
Return the number of keys in this index. |
long |
count(KeyType key)
Return the number of values for the key. |
HGRandomAccessResult |
find(KeyType key)
Retrieve all entries corresponding to the given key. |
ValueType |
findFirst(KeyType key)
Find the first indexed entry corresponding to the given key. |
HGRandomAccessResult |
findGT(KeyType key)
Return a range of all values strictly greater than the specified key. |
HGRandomAccessResult |
findGTE(KeyType key)
Return a range of all values greater than or equal to the specified key. |
HGRandomAccessResult |
findLT(KeyType key)
Return a range of all values strictly less than the specified key. |
HGRandomAccessResult |
findLTE(KeyType key)
Return a range of all values less than or equal to the specified key. |
java.util.Comparator |
getComparator()
|
java.lang.String |
getDatabaseName()
|
java.lang.String |
getName()
|
boolean |
isOpen()
Return true if the index is currently opened and
false otherwise. |
void |
open()
Open the index for use. |
void |
removeAllEntries(KeyType key)
Remove all entries in the index with a geven key. |
void |
removeEntry(KeyType key,
ValueType value)
Remove a specific entry in the index. |
HGRandomAccessResult<KeyType> |
scanKeys()
Return a result set containing all keys in this index. |
HGRandomAccessResult<ValueType> |
scanValues()
Return a result set containing all values in this index. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DB_NAME_PREFIX
| Constructor Detail |
|---|
public DefaultIndexImpl(java.lang.String indexName,
com.sleepycat.db.Environment env,
HGTransactionManager transactionManager,
ByteArrayConverter<KeyType> keyConverter,
ByteArrayConverter<ValueType> valueConverter,
java.util.Comparator comparator)
| Method Detail |
|---|
public java.lang.String getName()
public java.lang.String getDatabaseName()
public java.util.Comparator getComparator()
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.
open in interface HGIndex<KeyType,ValueType>public void close()
HGIndexClose 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.
close in interface HGIndex<KeyType,ValueType>public boolean isOpen()
HGIndexReturn true if the index is currently opened and
false otherwise.
isOpen in interface HGIndex<KeyType,ValueType>public HGRandomAccessResult<ValueType> scanValues()
HGIndexReturn a result set containing all values in this index.
scanValues in interface HGIndex<KeyType,ValueType>public HGRandomAccessResult<KeyType> scanKeys()
HGIndexReturn a result set containing all keys in this index.
scanKeys in interface HGIndex<KeyType,ValueType>
public void addEntry(KeyType key,
ValueType value)
HGIndexAdd an entry to the index.
addEntry in interface HGIndex<KeyType,ValueType>key - The entry's key part.value - The entry's value part.
public void removeEntry(KeyType key,
ValueType value)
HGIndexRemove a specific entry in the index. If an entry with this key and value does not exist, the method does not nothing.
removeEntry in interface HGIndex<KeyType,ValueType>key - The key part of the entry.value - The value part of the entry.public void removeAllEntries(KeyType key)
HGIndexRemove all entries in the index with a geven key. If an entry with this key does not exist, the method does not nothing.
removeAllEntries in interface HGIndex<KeyType,ValueType>key - The key all of whose corresponding entries will be removed.public ValueType findFirst(KeyType key)
HGIndexFind the first indexed entry corresponding to the given key. The first entry will generally be the one that was firstly added for that key. However, this is by no means guarantueed. This method is meant for indices where only a single value corresponds to a key. That is, in mathematical terms, indices that can be seen as functions.
findFirst in interface HGIndex<KeyType,ValueType>key - The key whose value is sought.
public HGRandomAccessResult find(KeyType key)
HGIndexRetrieve all entries corresponding to the given key. The order in which the entries are returned is not necessarily the order in which they were originally added.
find in interface HGIndex<KeyType,ValueType>find in interface HGSearchable<KeyType,ValueType>key - The key whose values are sought.
HGRandomAccessResult over all HGPersistentHandles under that key.public HGRandomAccessResult findGT(KeyType key)
HGOrderedSearchableReturn a range of all values strictly greater than the specified key.
findGT in interface HGOrderedSearchable<KeyType,ValueType>findGT in interface HGSortIndex<KeyType,ValueType>key - The search key.
HGSearchResult over the resulting range of values.public HGRandomAccessResult findGTE(KeyType key)
HGOrderedSearchableReturn a range of all values greater than or equal to the specified key.
findGTE in interface HGOrderedSearchable<KeyType,ValueType>findGTE in interface HGSortIndex<KeyType,ValueType>key - The search key.
HGSearchResult over the resulting range of values.public HGRandomAccessResult findLT(KeyType key)
HGOrderedSearchableReturn a range of all values strictly less than the specified key.
findLT in interface HGOrderedSearchable<KeyType,ValueType>findLT in interface HGSortIndex<KeyType,ValueType>key - The search key.
HGSearchResult over the resulting range of values.public HGRandomAccessResult findLTE(KeyType key)
HGOrderedSearchableReturn a range of all values less than or equal to the specified key.
findLTE in interface HGOrderedSearchable<KeyType,ValueType>findLTE in interface HGSortIndex<KeyType,ValueType>key - The search key.
HGSearchResult over the resulting range of values.public long count()
HGIndexReturn the number of keys in this index. This operation must run in constant time, regardless of the number of keys.
count in interface HGIndex<KeyType,ValueType>public long count(KeyType key)
HGIndexReturn the number of values for the key. This operation must run constant time regardless of the key or the number returned.
count in interface HGIndex<KeyType,ValueType>key - The key whose values must be counted.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||