|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
Interface of object index. This is base interface for Index and FieldIndex, allowing to write generic algorithms working with both itype of indices.
| Field Summary | |
|---|---|
static int |
ASCENT_ORDER
|
static int |
DESCENT_ORDER
|
| Method Summary | |
|---|---|
void |
clear()
Remove all objects from the index |
IterableIterator<java.util.Map.Entry<java.lang.Object,T>> |
entryIterator()
Get iterator for traversing all entries in the index. |
IterableIterator<java.util.Map.Entry<java.lang.Object,T>> |
entryIterator(Key from,
Key till,
int order)
Get iterator for traversing index entries with key belonging to the specified range. |
IterableIterator<java.util.Map.Entry<java.lang.Object,T>> |
entryIterator(java.lang.Object from,
java.lang.Object till,
int order)
Get iterator for traversing index entries with key belonging to the specified range. |
T |
get(Key key)
Get object by key (exact match) |
IPersistent[] |
get(Key from,
Key till)
Get objects which key value belongs to the specified range. |
T |
get(java.lang.Object key)
Get object by string key (exact match) |
IPersistent[] |
get(java.lang.Object from,
java.lang.Object till)
Get objects which key value belongs to the specified range. |
java.lang.Class |
getKeyType()
Get type of index key |
java.lang.Class[] |
getKeyTypes()
Get types of index compound key components |
java.util.ArrayList<T> |
getList(Key from,
Key till)
Get objects which key value belongs to the specified range. |
java.util.ArrayList<T> |
getList(java.lang.Object from,
java.lang.Object till)
Get objects which key value belongs to the specified range. |
IPersistent[] |
getPrefix(java.lang.String prefix)
Get objects with objects with key started with specified prefix, i.e. getPrefix("abc") will return "abc", "abcd", "abcdef", ... but not "ab". |
java.util.ArrayList<T> |
getPrefixList(java.lang.String prefix)
Get objects with string key prefix |
java.util.Iterator<T> |
iterator()
Get iterator for traversing all objects in the index. |
IterableIterator<T> |
iterator(Key from,
Key till,
int order)
Get iterator for traversing objects in the index with key belonging to the specified range. |
IterableIterator<T> |
iterator(java.lang.Object from,
java.lang.Object till,
int order)
Get iterator for traversing objects in the index with key belonging to the specified range. |
IterableIterator<T> |
prefixIterator(java.lang.String prefix)
Get iterator for records which keys started with specified prefix Objects are iterated in the ascent key order. |
IPersistent[] |
prefixSearch(java.lang.String word)
Locate all objects which key is prefix of specified word, i.e. prefixSearch("12345") will return "12", "123", "1234", "12345", but not "123456" |
java.util.ArrayList<T> |
prefixSearchList(java.lang.String word)
Locate all objects which key is prefix of specified word. |
int |
size()
Get number of objects in the index |
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 java.util.Collection |
|---|
add, addAll, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray |
| Field Detail |
|---|
static final int ASCENT_ORDER
static final int DESCENT_ORDER
| Method Detail |
|---|
void clear()
clear in interface java.util.CollectionIterableIterator<java.util.Map.Entry<java.lang.Object,T>> entryIterator()
Map.Entry interface
which allows to get entry key and value.
Objects are iterated in the ascent key order.
You should not update/remove or add members to the index during iteration
This iterator doesn't support remove method. If you want to update/remove
records during traversal, please use range iterator.
IterableIterator<java.util.Map.Entry<java.lang.Object,T>> entryIterator(Key from,
Key till,
int order)
Map.Entry interface
This iterator supports remove() method. To make it possible to update, remove or add
members to the index during iteration it is necessary to set "perst.concurrent.iterator"
property (by default it is not supported because it cause extra overhead during iteration)
from - low boundary. If null then low boundary is not specified.
Low boundary can be inclusive or exclusive.till - high boundary. If null then high boundary is not specified.
High boundary can be inclusive or exclusive.order - ASCENT_ORDER or DESCENT_ORDER
IterableIterator<java.util.Map.Entry<java.lang.Object,T>> entryIterator(java.lang.Object from,
java.lang.Object till,
int order)
Map.Entry interface
This iterator supports remove() method. To make it possible to update, remove or add
members to the index during iteration it is necessary to set "perst.concurrent.iterator"
property (by default it is not supported because it cause extra overhead during iteration)
from - inclusive low boundary. If null then low boundary is not specified.till - inclusive high boundary. If null then high boundary is not specified.order - ASCENT_ORDER or DESCENT_ORDER
T get(Key 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 index with specified value of the key.
IPersistent[] get(Key from,
Key till)
null.
In last case the method returns all objects from the index.
from - low boundary. If null then low boundary is not specified.
Low boundary can be inclusive or exclusive.till - high boundary. If null then high boundary is not specified.
High boundary can be inclusive or exclusive.
T get(java.lang.Object key)
key - packed key
null if key not[ found
StorageError(StorageError.KEY_NOT_UNIQUE) - exception if there are more than
one objects in the index with specified value of the key.
IPersistent[] get(java.lang.Object from,
java.lang.Object till)
null.
In last case the method returns all objects from the index.
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.lang.Class getKeyType()
java.lang.Class[] getKeyTypes()
java.util.ArrayList<T> getList(Key from,
Key till)
null.
In last case the method returns all objects from the index.
from - low boundary. If null then low boundary is not specified.
Low boundary can be inclusive or exclusive.till - high boundary. If null then high boundary is not specified.
High boundary can be 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 index.
from - inclusive low boundary. If null then low boundary is not specified.till - inclusive high boundary. If null then high boundary is not specified.
IPersistent[] getPrefix(java.lang.String prefix)
prefix - string key prefix
java.util.ArrayList<T> getPrefixList(java.lang.String prefix)
prefix - string key prefix
java.util.Iterator<T> iterator()
iterator in interface java.util.Collection
IterableIterator<T> iterator(Key from,
Key till,
int order)
from - low boundary. If null then low boundary is not specified.
Low boundary can be inclusive or exclusive.till - high boundary. If null then high boundary is not specified.
High boundary can be inclusive or exclusive.order - ASCENT_ORDER or DESCENT_ORDER
IterableIterator<T> iterator(java.lang.Object from,
java.lang.Object till,
int order)
from - inclusive low boundary. If null then low boundary is not specified.
Low boundary can be inclusive or exclusive.till - inclusive high boundary. If null then high boundary is not specified.order - ASCENT_ORDER or DESCENT_ORDER
IterableIterator<T> prefixIterator(java.lang.String prefix)
prefix - key prefix
IPersistent[] prefixSearch(java.lang.String word)
word - string which prefixes are located in index
java.util.ArrayList<T> prefixSearchList(java.lang.String word)
word - string which prefixes are located in index
int size()
size in interface java.util.CollectionIPersistent[] toPersistentArray()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||