|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectch.javasoft.jbase.util.CachedTableWeakReference<E>
public class CachedTableWeakReference<E>
The CachedTableWeakReference is a table which caches entries of
an underlying tables using weak references. Weak
references are possibly cleared by the garbage collector on the demand of
memory.
| Constructor Summary | |
|---|---|
CachedTableWeakReference(Table<E> baseTable)
|
|
CachedTableWeakReference(Table<E> baseTable,
int paletteSize,
boolean cacheOnWrite)
|
|
| Method Summary | |
|---|---|
int |
add(E entity)
Adds a new entity to the table. |
protected void |
cacheEntity(int index,
E entity,
boolean force)
|
void |
clearCache()
|
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. |
protected ch.javasoft.jbase.util.CachedTableWeakReference.Palette |
getPalette(int index,
boolean forceCreate)
|
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 CachedTableWeakReference(Table<E> baseTable)
public CachedTableWeakReference(Table<E> baseTable,
int paletteSize,
boolean cacheOnWrite)
| Method Detail |
|---|
protected ch.javasoft.jbase.util.CachedTableWeakReference.Palette getPalette(int index,
boolean forceCreate)
protected void cacheEntity(int index,
E entity,
boolean force)
public int add(E entity)
throws IOException
Tablesize-1 after adding
the new entity.
add in interface Table<E>IOException
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>IOException
public void close(boolean erase)
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.
close in interface Table<E>IOException
public void flush()
throws IOException
Table
flush in interface Table<E>IOException
public E get(int index)
throws IOException
Table
get in interface Table<E>IOException
public void remove(int index)
throws IOException
Table
remove in interface Table<E>IOException
public void set(int index,
E entity)
throws IOException
Table
set in interface Table<E>IOException
public void swap(int indexA,
int indexB)
throws IOException
Table
swap in interface Table<E>IOException
public int size()
throws IOException
Table
size in interface Table<E>IOExceptionpublic void clearCache()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||