SableJBDD.cache
Class IdealCache

java.lang.Object
  extended bySableJBDD.cache.CacheProfiler
      extended bySableJBDD.cache.IdealCache
All Implemented Interfaces:
Profiling, TripleIntKeyCache

public class IdealCache
extends CacheProfiler
implements TripleIntKeyCache


Field Summary
 
Fields inherited from interface SableJBDD.bdd.util.Profiling
PROFILING
 
Constructor Summary
IdealCache(int capacity)
          Defines an ideal cache with the specific number of entries.
 
Method Summary
 int getAssociativity()
          Returns the cache associativity.
 void invalidate(int key0, int key1, int key2)
          Removes an entry which matches the key
 java.lang.Object lookup(int key0, int key1, int key2)
          Looks up the value object associated with a key.
 int numberOfEntries()
          Returns the number of cache entries.
 void put(int key0, int key1, int key2, java.lang.Object value)
          Puts a (key, value) pair into the cache.
 void reset()
          Resets all cache entries
 
Methods inherited from class SableJBDD.cache.CacheProfiler
accesses, hitRate, hits, misses, missRate, reportStatistics, steps
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface SableJBDD.bdd.util.Profiling
reportStatistics
 

Constructor Detail

IdealCache

public IdealCache(int capacity)
Defines an ideal cache with the specific number of entries.

Method Detail

lookup

public java.lang.Object lookup(int key0,
                               int key1,
                               int key2)
Looks up the value object associated with a key.

Specified by:
lookup in interface TripleIntKeyCache
Parameters:
key0 - the 1st key
key1 - the 2nd key
key2 - the 3rd key
Returns:
the value object associated with the key

put

public void put(int key0,
                int key1,
                int key2,
                java.lang.Object value)
Puts a (key, value) pair into the cache. It is the caller's reponsibility to ensure the (key, value) does not exist in the cache. The cache entry is inserted at the beginning of the list.

Specified by:
put in interface TripleIntKeyCache
Parameters:
key0 - the 1st key
key1 - the 2nd key
key2 - the 3rd key
value - the cache value

reset

public void reset()
Resets all cache entries

Specified by:
reset in interface TripleIntKeyCache

invalidate

public void invalidate(int key0,
                       int key1,
                       int key2)
Removes an entry which matches the key

Specified by:
invalidate in interface TripleIntKeyCache
Parameters:
key0 - the 1st key
key1 - the 2nd key
key2 - the 3rd key

numberOfEntries

public int numberOfEntries()
Returns the number of cache entries.

Specified by:
numberOfEntries in interface TripleIntKeyCache
Returns:
the number of cache entries

getAssociativity

public int getAssociativity()
Returns the cache associativity.

Specified by:
getAssociativity in interface TripleIntKeyCache
Returns:
the cache associativity