Framework Professional Edition Package


com.prosyst.util.hash
Class LRUCache

java.lang.Object
  extended by java.util.Dictionary
      extended by com.prosyst.util.hash.LRUCache

public class LRUCache
extends java.util.Dictionary

LRUCache is a dictionary, that holds only the last most-used entries. The entries, which are used less, are discarded and no-longer referred. Note - that dictionary is fixed in size and is not thread-safe!

Author:
Valentin Valchev

Constructor Summary
LRUCache(int maxSize)
          LRU Cache
 
Method Summary
 void clear()
          Clears the elements in the cache
 java.util.Enumeration elements()
           
 java.lang.Object get(java.lang.Object key)
           
 boolean isEmpty()
           
 java.util.Enumeration keys()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 java.lang.Object remove(java.lang.Object key)
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LRUCache

public LRUCache(int maxSize)
LRU Cache

Parameters:
maxSize - the maximum cache size
Method Detail

elements

public java.util.Enumeration elements()
Specified by:
elements in class java.util.Dictionary
See Also:
Dictionary.elements()

keys

public java.util.Enumeration keys()
Specified by:
keys in class java.util.Dictionary
See Also:
Dictionary.keys()

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in class java.util.Dictionary
See Also:
Dictionary.isEmpty()

size

public int size()
Specified by:
size in class java.util.Dictionary
See Also:
Dictionary.size()

clear

public void clear()
Clears the elements in the cache


put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in class java.util.Dictionary
See Also:
Dictionary.put(java.lang.Object, java.lang.Object)

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in class java.util.Dictionary
See Also:
Dictionary.remove(java.lang.Object)

get

public java.lang.Object get(java.lang.Object key)
Specified by:
get in class java.util.Dictionary
See Also:
Dictionary.get(java.lang.Object)

Framework Professional Edition Package


Copyright © 1999-2007 ProSyst Software GmbH. All Rights Reserved