at.tuwien.ifs.somtoolbox.util
Class LeastRecentelyUsedImageCache

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by java.util.LinkedHashMap<String,BufferedImage>
              extended by at.tuwien.ifs.somtoolbox.util.LeastRecentelyUsedImageCache
All Implemented Interfaces:
Serializable, Cloneable, Map<String,BufferedImage>

public final class LeastRecentelyUsedImageCache
extends LinkedHashMap<String,BufferedImage>

A least-recently-used LRU cache, based on LinkedHashMap. This cache can hold a fixed a number of BufferedImage elements, until the specified memory limit is reached. If a new element is added, and the cache is full, the least recently used entry is removed.

Version:
$Id: LeastRecentelyUsedImageCache.java 3601 2010-06-23 13:40:28Z mayer $
Author:
Rudolf Mayer
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Field Summary
private  long maxCacheSize
           
private  String maxCacheSizeReadable
           
private static long serialVersionUID
           
 
Constructor Summary
LeastRecentelyUsedImageCache(long maxCacheSize)
           
 
Method Summary
protected  boolean removeEldestEntry(Map.Entry<String,BufferedImage> eldest)
           
 
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, get
 
Methods inherited from class java.util.HashMap
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
containsKey, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

maxCacheSize

private long maxCacheSize

maxCacheSizeReadable

private String maxCacheSizeReadable
Constructor Detail

LeastRecentelyUsedImageCache

public LeastRecentelyUsedImageCache(long maxCacheSize)
Method Detail

removeEldestEntry

protected boolean removeEldestEntry(Map.Entry<String,BufferedImage> eldest)
Overrides:
removeEldestEntry in class LinkedHashMap<String,BufferedImage>