|
||||||||
| 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(IPersistent obj)
Add new member to collection |
void |
clear()
Remove all objects from the collection |
boolean |
contains(IPersistent 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(IPersistent obj)
Check if collections contains specified object instance |
IPersistent |
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 |
getComparator()
Get comparator used in this collection |
java.util.Iterator |
iterator()
Get iterator for traversing all collection members. |
java.util.Iterator |
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. |
java.util.Iterator |
iterator(java.lang.Object from,
java.lang.Object till)
Get iterator for traversing collection members with key belonging to the specified range. |
void |
remove(IPersistent 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. |
IPersistent[] |
toPersistentArray(IPersistent[] arr)
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 |
| Method Detail |
public boolean add(IPersistent 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.public void clear()
public boolean contains(IPersistent obj)
obj - object to be searched in the collection
true if collection contains object equals to the specifiedpublic boolean containsObject(IPersistent obj)
obj - object to be searched in the collection
true if specified member belongs to the collectionpublic IPersistent get(java.lang.Object key)
key - specified key. It should match with type of the index and should be inclusive.
null if key not found
StorageError(StorageError.KEY_NOT_UNIQUE) - exception if there are more than
one objects in the collection with specified value of the key.
public 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
public 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.
public PersistentComparator getComparator()
public java.util.Iterator iterator()
iterator in interface ITable
public java.util.Iterator 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
public java.util.Iterator 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.
public void remove(IPersistent obj)
obj - member to be removed
StorageError(StorageError.KEY_NOT_FOUND) - exception if there is no such key in the collectionpublic int size()
size in interface ITablepublic IPersistent[] toPersistentArray()
public IPersistent[] toPersistentArray(IPersistent[] arr)
If this index fits in the specified array with room to spare (i.e., the array has more elements than this index), the element in the array immediately following the end of the index is set to null. This is useful in determining the length of this index only if the caller knows that this index does not contain any null elements.)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||