Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.opencms.flex.util
Class CmsLruHashMap  view CmsLruHashMap download CmsLruHashMap.java

java.lang.Object
  extended byjava.util.AbstractMap
      extended byjava.util.HashMap
          extended bycom.opencms.flex.util.CmsLruHashMap
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class CmsLruHashMap
extends java.util.HashMap

A hash table based implementation of the Map interface with limited size and a "last-recently-used" cache policy of the mapped key/values.

Version:
$Revision: 1.8 $

Nested Class Summary
(package private)  class CmsLruHashMap.CmsLruCacheObject
          An object saved under the LRU policy in a CmsLruHashMap.
 
Nested classes inherited from class java.util.HashMap
 
Nested classes inherited from class java.util.AbstractMap
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
private  CmsFlexLruCache m_LruCache
          LRU cache to organize the cached objects efficient.
 
Fields inherited from class java.util.HashMap
 
Fields inherited from class java.util.AbstractMap
 
Constructor Summary
CmsLruHashMap()
          Creates a LRU hash map with an initial capacity of (16), a load factor of (0.75), and a max.
CmsLruHashMap(int initialCapacity)
          Creates a LRU hash map with a given initial capacity, a load factor of (0.75), and a max.
CmsLruHashMap(int initialCapacity, float loadFactor)
          Creates a LRU hash map with a given initial capacity, a given load factor, and a max.
CmsLruHashMap(int initialCapacity, float loadFactor, int maxLruSize)
          Creates a LRU hash map with a given initial capacity, a given load factor, and a given max.
CmsLruHashMap(int initialCapacity, int maxLruSize)
          Creates a LRU hash map with a given initial capacity, a load factor of (0.75), and a given max.
 
Method Summary
 void clear()
          Removes all objects from this map.
protected  void finalize()
          Clears any allocated resources during finalization.
 java.lang.Object get(java.lang.Object key)
          Returns the value to which the specified key is mapped in this identity hash map, or null if the map contains no mapping for this key.
 CmsFlexLruCache getLruCache()
          Returns the internal cache used for the LRU policy.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Associates the specified value with the specified key in this map.
 void putAll(java.util.Map t)
          Copies all of the mappings from the specified map to this map.
 java.lang.Object remove(java.lang.Object key)
          Removes the mapping for this key from this map if present.
 
Methods inherited from class java.util.HashMap
clone, containsKey, containsValue, entrySet, isEmpty, keySet, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

m_LruCache

private CmsFlexLruCache m_LruCache
LRU cache to organize the cached objects efficient.

Constructor Detail

CmsLruHashMap

public CmsLruHashMap()
Creates a LRU hash map with an initial capacity of (16), a load factor of (0.75), and a max. size of cacheable objects of (36).


CmsLruHashMap

public CmsLruHashMap(int initialCapacity)
Creates a LRU hash map with a given initial capacity, a load factor of (0.75), and a max. size of cacheable objects of (initialCapacity*3*0.75).


CmsLruHashMap

public CmsLruHashMap(int initialCapacity,
                     float loadFactor)
Creates a LRU hash map with a given initial capacity, a given load factor, and a max. size of cacheable objects of (initialCapacity*3*loadFactor).


CmsLruHashMap

public CmsLruHashMap(int initialCapacity,
                     int maxLruSize)
Creates a LRU hash map with a given initial capacity, a load factor of (0.75), and a given max. size of cacheable objects.


CmsLruHashMap

public CmsLruHashMap(int initialCapacity,
                     float loadFactor,
                     int maxLruSize)
Creates a LRU hash map with a given initial capacity, a given load factor, and a given max. size of cacheable objects.

Method Detail

clear

public void clear()
Removes all objects from this map.


finalize

protected void finalize()
                 throws java.lang.Throwable
Clears any allocated resources during finalization.


get

public java.lang.Object get(java.lang.Object key)
Returns the value to which the specified key is mapped in this identity hash map, or null if the map contains no mapping for this key.

A return value of null does not necessarily indicate that the map contains no mapping for the key; it is also possible that the map explicitly maps the key to null. The containsKey method may be used to distinguish these two cases.


put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Associates the specified value with the specified key in this map.

If the map previously contained a mapping for this key, the old value is replaced.


putAll

public void putAll(java.util.Map t)
Copies all of the mappings from the specified map to this map.

These mappings will replace any mappings that this map had for any of the keys currently in the specified map.


remove

public java.lang.Object remove(java.lang.Object key)
Removes the mapping for this key from this map if present.


getLruCache

public CmsFlexLruCache getLruCache()
Returns the internal cache used for the LRU policy.