|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.udo.cs.mySVM.Util.Cache
public class Cache
Implements a last recently used cache
Field Summary | |
---|---|
(package private) int |
cache_size
number of rows in cache |
(package private) long |
counter
time index for last access |
protected java.lang.Object[] |
elements
Cache rows |
(package private) int[] |
index
|
(package private) long[] |
last_used
the heap |
Constructor Summary | |
---|---|
Cache()
constructor |
|
Cache(int size,
int dim)
constructor + init(size) |
Method Summary | |
---|---|
boolean |
cached(int i)
is element at this position cached? |
protected void |
clean_cache()
cleans the cache |
java.lang.Object |
get_element(int i)
get element from cache |
java.lang.Object |
get_lru_element()
|
int |
get_lru_pos()
|
void |
init(int size)
initialises the cache |
protected int |
lookup(int i)
|
void |
put_element(int i,
java.lang.Object o)
put element in cache |
void |
renew(int i)
mark element as recently used |
void |
shrink(int size,
int dim)
|
void |
swap(int i,
int j)
swap elements in cache |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.Object[] elements
long counter
int cache_size
long[] last_used
int[] index
Constructor Detail |
---|
public Cache()
public Cache(int size, int dim)
size
- number of elements to be cachedMethod Detail |
---|
public void init(int size)
size
- number of elements to be cachedpublic void shrink(int size, int dim)
protected void clean_cache()
public java.lang.Object get_element(int i)
public int get_lru_pos()
public java.lang.Object get_lru_element()
public void put_element(int i, java.lang.Object o)
protected int lookup(int i)
public boolean cached(int i)
public void renew(int i)
public void swap(int i, int j)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |