|
|||||||||
| 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.IntStorageIndex<K,T>
K - the type of keys this index is ordered byT - the type of objects stored in this collectionpublic class IntStorageIndex<K,T>
Implementation of a single index over a storage with integer addresses.
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 | |
|---|---|
IntStorageIndex(IntStorage<T> storage,
IndexComparator<K,T> comparator)
Creates a new instance of IntStorageIndex 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 IntStorageIndex(IntStorage<T> storage,
IndexComparator<K,T> comparator)
storage - the storage to associate with this indexcomparator - the comparator imposing natural order of this index| Method 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 cleaning
public 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 point
public 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()
AbstractArrayIndexLock.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 | ||||||||