|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectch.javasoft.jbase.MemoryTable<E>
public class MemoryTable<E>
The MemoryTable stores the entities in memory in an
array list.
| Constructor Summary | |
|---|---|
MemoryTable()
Constructor for an empty MemoryTable with storing entities
in an ArrayList instance. |
|
MemoryTable(List<E> list)
Constructor for a MemoryTable based on the specified list
instance. |
|
| 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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MemoryTable()
MemoryTable with storing entities
in an ArrayList instance.
public MemoryTable(List<E> list)
MemoryTable based on the specified list
instance. Changes to the list are also reflected by this memory table
(and vice versa).
| Method Detail |
|---|
public int add(E entity)
Tablesize-1 after adding
the new entity.
add in interface Table<E>public void close(boolean erase)
Tableflushed,
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.
close in interface Table<E>public void flush()
Table
flush in interface Table<E>public E get(int index)
Table
get in interface Table<E>public void remove(int index)
Table
remove in interface Table<E>
public void set(int index,
E entity)
Table
set in interface Table<E>
public void swap(int indexA,
int indexB)
Table
swap in interface Table<E>
public void removeAll()
throws IOException
Tableflushed,
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.
removeAll in interface Table<E>IOExceptionpublic int size()
Table
size in interface Table<E>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||