|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
Interface of sorted collection. Sorted collections keeps in members in order specified by comparator. Members in the collections can be located using key or range of keys. The SortedCollection is efficient container of objects for in-memory databases. For databases which size is significatly larger than size of page pool, operation with SortedList can cause trashing and so very bad performance. Unlike other index structures SortedCollection doesn't store values of keys and so search in the collection requires fetching of its members.
| Method Summary | |
|---|---|
boolean |
add(T obj)
Add new member to collection |
void |
clear()
Remove all objects from the collection |
boolean |
contains(T obj)
Check if collections contains member equals to specified object More formally, returns true if and only if this collection contains at least one element e such that (obj==null ? |
boolean |
containsObject(T obj)
Check if collections contains specified object instance |
T |
get(java.lang.Object key)
Get member with specified key. |
IPersistent[] |
get(java.lang.Object from,
boolean fromInclusive,
java.lang.Object till,
boolean tillInclusive)
Get members which key value belongs to the specified range. |
IPersistent[] |
get(java.lang.Object from,
java.lang.Object till)
Get members which key value belongs to the specified range. |
PersistentComparator<T> |
getComparator()
Get comparator used in this collection |
java.util.ArrayList<T> |
getList(java.lang.Object from,
boolean fromInclusive,
java.lang.Object till,
boolean tillInclusive)
Get members which key value belongs to the specified range. |
java.util.ArrayList<T> |
getList(java.lang.Object from,
java.lang.Object till)
Get members which key value belongs to the specified range. |
java.util.Iterator<T> |
iterator()
Get iterator for traversing all collection members. |
IterableIterator<T> |
iterator(java.lang.Object from,
boolean fromInclusive,
java.lang.Object till,
boolean tillInclusive)
Get iterator for traversing collection members with key belonging to the specified range. |
IterableIterator<T> |
iterator(java.lang.Object from,
java.lang.Object till)
Get iterator for traversing collection members with key belonging to the specified range. |
void |
remove(T obj)
Remove member from collection |
int |
size()
Get number of objects in the collection |
IPersistent[] |
toPersistentArray()
Get all objects in the index as array ordered by index key. |
| Methods inherited from interface org.garret.perst.IPersistent |
|---|
assignOid, deallocate, getOid, getStorage, invalidate, isDeleted, isModified, isPersistent, isRaw, load, loadAndModify, makePersistent, modify, onLoad, onStore, recursiveLoading, store |
| Methods inherited from interface java.io.Externalizable |
|---|
readExternal, writeExternal |
| Methods inherited from interface org.garret.perst.IResource |
|---|
exclusiveLock, exclusiveLock, reset, sharedLock, sharedLock, unlock |
| Methods inherited from interface org.garret.perst.ITable |
|---|
select |
| Methods inherited from interface java.util.Collection |
|---|
add, addAll, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray |
| Method Detail |
|---|
boolean add(T obj)
obj - new member
true if object is successfully added in the index,
false if collection was declared as unique and there is already member with such value
of the key in the collection.void clear()
clear in interface java.util.Collectionboolean contains(T obj)
obj - object to be searched in the collection
true if collection contains object equals to the specifiedboolean containsObject(T obj)
obj - object to be searched in the collection
true if specified member belongs to the collectionT get(java.lang.Object key)
key - specified key. It should match with type of the index and should be inclusive.
null if key nmot found
StorageError(StorageError.KEY_NOT_UNIQUE) - exception if there are more than
one objects in the collection with specified value of the key.
IPersistent[] get(java.lang.Object from,
boolean fromInclusive,
java.lang.Object till,
boolean tillInclusive)
null.
In last case the method returns all objects from the collection.
from - inclusive low boundary. If null then low boundary is not specified.fromInclusive - specifies whether from boundary is inclusive or exclusivetill - inclusive high boundary. If null then high boundary is not specified.tillInclusive - specifies whether till boundary is inclusive or exclusive
IPersistent[] get(java.lang.Object from,
java.lang.Object till)
null.
In last case the method returns all objects from the collection.
from - inclusive low boundary. If null then low boundary is not specified.till - inclusive high boundary. If null then high boundary is not specified.
High boundary can be inclusive or exclusive.
PersistentComparator<T> getComparator()
java.util.ArrayList<T> getList(java.lang.Object from,
boolean fromInclusive,
java.lang.Object till,
boolean tillInclusive)
null.
In last case the method returns all objects from the collection.
from - inclusive low boundary. If null then low boundary is not specified.fromInclusive - specifies whether from boundary is inclusive or exclusivetill - inclusive high boundary. If null then high boundary is not specified.tillInclusive - specifies whether till boundary is inclusive or exclusive
java.util.ArrayList<T> getList(java.lang.Object from,
java.lang.Object till)
null.
In last case the method returns all objects from the collection.
from - inclusive low boundary. If null then low boundary is not specified.till - inclusive high boundary. If null then high boundary is not specified.
java.util.Iterator<T> iterator()
iterator in interface java.util.Collection
IterableIterator<T> iterator(java.lang.Object from,
boolean fromInclusive,
java.lang.Object till,
boolean tillInclusive)
from - inclusive low boundary. If null then low boundary is not specified.fromInclusive - specifies whether from boundary is inclusive or exclusivetill - inclusive high boundary. If null then high boundary is not specified.tillInclusive - specifies whether till boundary is inclusive or exclusive
IterableIterator<T> iterator(java.lang.Object from,
java.lang.Object till)
from - inclusive low boundary. If null then low boundary is not specified.till - inclusive high boundary. If null then high boundary is not specified.
void remove(T obj)
obj - member to be removed
StorageError(StorageError.KEY_NOT_FOUND) - exception if there is no such key in the collectionint size()
size in interface java.util.CollectionIPersistent[] toPersistentArray()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||