|
||||||||
| 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 |
java.util.Iterator |
entryIterator()
Get iterator for traversing all entries in the index. |
java.util.Iterator |
entryIterator(Key from,
Key till,
int order)
Get iterator for traversing index entries with key belonging to the specified range. |
IPersistent |
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. |
IPersistent |
get(java.lang.String key)
Get object by string key (exact match) |
java.lang.Class |
getKeyType()
Get type of index key |
java.lang.Class[] |
getKeyTypes()
Get types of index compound key components |
IPersistent[] |
getPrefix(java.lang.String prefix)
Get objects with string key prefix |
java.util.Iterator |
iterator()
Get iterator for traversing all objects in the index. |
java.util.Iterator |
iterator(Key from,
Key till,
int order)
Get iterator for traversing objects in the index with key belonging to the specified range. |
java.util.Iterator |
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. |
int |
size()
Get number of objects in the index |
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 |
| Field Detail |
public static final int ASCENT_ORDER
public static final int DESCENT_ORDER
| Method Detail |
public void clear()
public java.util.Iterator 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.
public java.util.Iterator 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
public IPersistent 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.
public 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.
public IPersistent get(java.lang.String key)
key - string 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.public java.lang.Class getKeyType()
public java.lang.Class[] getKeyTypes()
public IPersistent[] getPrefix(java.lang.String prefix)
prefix - string key prefix
public java.util.Iterator iterator()
iterator in interface ITable
public java.util.Iterator 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
public java.util.Iterator prefixIterator(java.lang.String prefix)
prefix - key prefix
public IPersistent[] prefixSearch(java.lang.String word)
word - string which prefixes are located in index
public 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.)
arr - specified array
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||