|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ObjectIndex
ObjectIndex
defines the concept of an index
that associates key
values with references to serializable objects. Concrete subclasses of ObjectIndex
assume that an object's position
(as given by a long
value) is constant,
regardless of the actual meaning of that position. In general, the position represents the * location (file pointer) of a Serializable
object in an IndexedObjectDatabase
. *
* Use the IndexedObjectDatabase.attachIndex
method to attach an ObjectIndex
* to a database. A database updates all attached indexes when it writes or removes objects * from its file.
ObjectIndex
,
IndexedObjectDatabase
Method Summary | |
---|---|
long |
findKey(KeyObject key)
Find the position of the object associated with a given key. |
void |
insertKey(KeyObject key,
long pos)
Insert a key into the database, associating a record position with the given key. |
void |
removeKey(KeyObject key)
Removes the given key from the index. |
void |
replaceKey(KeyObject key,
long pos)
Replace the reference pos for the given key. |
void |
storeKey(KeyObject key,
long pos)
If the key already exists, replace the reference pos for the given key. |
Method Detail |
---|
void insertKey(KeyObject key, long pos) throws java.io.IOException, java.lang.ClassNotFoundException
DuplicateKey
exception if the key already exists.
key
- A key identifying the record to be read.pos
- File position of record associated with key
java.io.IOException
- when an I/O exception is thrown by an underlying java.io.* class
java.lang.ClassNotFoundException
- for a casting error, usually when a persistent object or index does
match the expected type
DuplicateKey
- when inserting a duplicate key into an index that does not
support duplicatesDuplicateKey
,
KeyObject
void replaceKey(KeyObject key, long pos) throws java.io.IOException, java.lang.ClassNotFoundException
KeyNotFound
exception if the requested key does not exist in the index.
key
- A key identifying the record to be read.pos
- File position of record associated with key
java.io.IOException
- when an I/O exception is thrown by an underlying java.io.* class
java.lang.ClassNotFoundException
- for a casting error, usually when a persistent object or index does
match the expected type
KeyNotFound
- when the specified key can not be found in the indexKeyNotFound
,
KeyObject
void storeKey(KeyObject key, long pos) throws java.io.IOException, java.lang.ClassNotFoundException
key
- A key identifying the record to be read.pos
- File position of record associated with key
java.io.IOException
- when an I/O exception is thrown by an underlying java.io.* class
java.lang.ClassNotFoundException
- for a casting error, usually when a persistent object or index does
match the expected typeKeyObject
long findKey(KeyObject key) throws java.io.IOException, java.lang.ClassNotFoundException
key
- A key identifying the record to be read.
key
.
java.io.IOException
- when an I/O exception is thrown by an underlying java.io.* class
java.lang.ClassNotFoundException
- for a casting error, usually when a persistent object or index does
match the expected type
KeyNotFound
- when the specified key can not be found in the indexKeyNotFound
,
KeyObject
void removeKey(KeyObject key) throws java.io.IOException, java.lang.ClassNotFoundException
key
- A key identifying the record to be read.
java.io.IOException
- when an I/O exception is thrown by an underlying java.io.* class
java.lang.ClassNotFoundException
- for a casting error, usually when a persistent object or index does
match the expected type
KeyNotFound
- when the specified key can not be found in the indexKeyNotFound
,
KeyObject
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |