com.rapidminer.operator.learner.functions.kernel.jmysvm.util
Class Cache

java.lang.Object
  extended by com.rapidminer.operator.learner.functions.kernel.jmysvm.util.Cache

public class Cache
extends java.lang.Object

Implements a last recently used cache

Author:
Stefan Rueping

Field Summary
protected  java.lang.Object[] elements
          Cache rows
 
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

elements

protected java.lang.Object[] elements
Cache rows

Constructor Detail

Cache

public Cache()
constructor


Cache

public Cache(int size,
             int dim)
constructor + init(size)

Parameters:
size - number of elements to be cached
Method Detail

init

public void init(int size)
initialises the cache

Parameters:
size - number of elements to be cached

shrink

public void shrink(int size,
                   int dim)

clean_cache

protected void clean_cache()
cleans the cache


get_element

public java.lang.Object get_element(int i)
get element from cache


get_lru_pos

public int get_lru_pos()

get_lru_element

public java.lang.Object get_lru_element()

put_element

public void put_element(int i,
                        java.lang.Object o)
put element in cache


lookup

protected int lookup(int i)

cached

public boolean cached(int i)
is element at this position cached?


renew

public void renew(int i)
mark element as recently used


swap

public void swap(int i,
                 int j)
swap elements in cache



Copyright © 2001-2009 by Rapid-I