|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Table<E>
A Table stores entity objects, sometimes called row. Entities
can be added, removed and accessed by index.
The underlying mechanism to store the entities can be persistent (e.g. in a file or database) or volatile (e.g. stored in memory only). Different strategies might be used, for instance, entities with predefined size might be stored in a more efficient way than variable size objects. It is also possible to use caches in front of persistent tables to improve performance.
| Method Summary | |
|---|---|
int |
add(E entity)
Adds a new entity to the table. |
void |
close(boolean erase)
Closes this table. |
void |
flush()
Flush ensures that all write operations are persisted. |
E |
get(int index)
Returns the entity at the given position. |
void |
remove(int index)
Removes the entity at the given position from the table. |
void |
removeAll()
Closes this table. |
void |
set(int index,
E entity)
Replaces the entity at the given position by the specified entity. |
int |
size()
Returns the size of the table, i.e. |
void |
swap(int indexA,
int indexB)
Swaps the two entities specified by their index. |
| Method Detail |
|---|
int size()
throws IOException
IOException
E get(int index)
throws IOException
IOException
void set(int index,
E entity)
throws IOException
IOException
void swap(int indexA,
int indexB)
throws IOException
IOException
int add(E entity)
throws IOException
size-1 after adding
the new entity.
IOException
void remove(int index)
throws IOException
IOException
void removeAll()
throws IOException
flushed,
and underlying files are closed. Subsequent access to the table
is not allowed and causes exceptions. Multiple calls to this
close method do not cause any exceptions.
IOException
void flush()
throws IOException
IOException
void close(boolean erase)
throws IOException
flushed,
and underlying files are closed. Subsequent access to the table
is not allowed and causes exceptions. Multiple calls to this
close method do not cause any exceptions.
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||