|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmessif.utility.SortedArrayData<K,T>
messif.buckets.index.impl.AbstractArrayIndex<K,T>
messif.buckets.index.impl.AddressStorageIndex<K,T>
K
- the type of keys this index is ordered byT
- the type of objects stored in this collectionpublic class AddressStorageIndex<K,T>
Implementation of a single index over generic storage.
The addresses provided by the storage are kept in internal sorted array
that allows fast access to data in the storage. Objects are indexed
according to the given IndexComparator
.
Constructor Summary | |
---|---|
AddressStorageIndex(Storage<T> storage,
IndexComparator<K,T> comparator)
Creates a new instance of AddressStorageIndex for the specified storage. |
Method Summary | |
---|---|
protected Lock |
acquireSearchLock()
Locks this index for searching and returns a lock object if it is supported. |
boolean |
add(T object)
Adds the specified object to this instance. |
IndexComparator<K,T> |
comparator()
Returns the comparator that defines order of this index. |
protected int |
compare(K key,
T object)
Compares its two arguments for order. |
void |
destroy()
Destroy this index. |
void |
finalize()
Finalize this index. |
protected T |
get(int i)
Returns the element at the specified position in this collection. |
protected int |
insertionPoint(T object)
Searches for the point where to insert the object object . |
protected boolean |
remove(int i)
Removes the element at the specified position in this collection. |
int |
size()
Returns the number of elements in this collection. |
Methods inherited from class messif.buckets.index.impl.AbstractArrayIndex |
---|
search, search, search, search, search, search, search, search |
Methods inherited from class messif.utility.SortedArrayData |
---|
binarySearch, first, fullSearch, indexOf, last, mergeSort |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AddressStorageIndex(Storage<T> storage, IndexComparator<K,T> comparator)
storage
- the storage to associate with this indexcomparator
- the comparator imposing natural order of this indexMethod Detail |
---|
public void finalize() throws java.lang.Throwable
ModifiableIndex
finalize
in interface ModifiableIndex<T>
finalize
in class AbstractArrayIndex<K,T>
java.lang.Throwable
- if there was an error while cleaningpublic void destroy() throws java.lang.Throwable
ModifiableIndex
destroy
in interface ModifiableIndex<T>
java.lang.Throwable
- if there was an error while cleaningpublic IndexComparator<K,T> comparator()
OrderedIndex
comparator
in interface OrderedIndex<K,T>
protected int compare(K key, T object) throws java.lang.ClassCastException
SortedArrayData
compare
in class SortedArrayData<K,T>
key
- the key to indexCompareobject
- the object to be compared
java.lang.ClassCastException
- if the arguments' types prevent them from
being compared by this comparator.public int size()
SortedArrayData
size
in interface Index<T>
size
in class SortedArrayData<K,T>
protected int insertionPoint(T object) throws BucketStorageException
object
.
object
- the object to insert
BucketStorageException
- if there was a problem determining the pointpublic boolean add(T object) throws BucketStorageException
Addible
add
in interface Addible<T>
object
- the object to be added
BucketStorageException
- if there was an error adding the objectprotected boolean remove(int i)
AbstractArrayIndex
remove
in class AbstractArrayIndex<K,T>
i
- index of the element to remove
protected T get(int i) throws java.lang.IndexOutOfBoundsException, java.lang.IllegalStateException
SortedArrayData
get
in class SortedArrayData<K,T>
i
- index of the element to return
java.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= size())
java.lang.IllegalStateException
- if the object at position index
cannot be accessedprotected Lock acquireSearchLock()
AbstractArrayIndex
Lock.unlock()
method if this method has returned non-null.
acquireSearchLock
in class AbstractArrayIndex<K,T>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |