com.jme3.terrain.geomipmap
クラス LRUCache<K,V>

java.lang.Object
  上位を拡張 com.jme3.terrain.geomipmap.LRUCache<K,V>

public class LRUCache<K,V>
extends java.lang.Object

An LRU cache, based on LinkedHashMap.

This cache has a fixed maximum number of elements (cacheSize). If the cache is full and another entry is added, the LRU (least recently used) entry is dropped.

This class is thread-safe. All methods of this class are synchronized.

Author: Christian d'Heureuse, Inventec Informatik AG, Zurich, Switzerland
Multi-licensed: EPL / LGPL / GPL / AL / BSD.


コンストラクタの概要
LRUCache(int cacheSize)
          Creates a new LRU cache.
 
メソッドの概要
 void clear()
          Clears the cache.
 V get(K key)
          Retrieves an entry from the cache.
 java.util.Collection<java.util.Map.Entry<K,V>> getAll()
          Returns a Collection that contains a copy of all cache entries.
 void put(K key, V value)
          Adds an entry to this cache.
 int usedEntries()
          Returns the number of used entries in the cache.
 
クラス java.lang.Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

LRUCache

public LRUCache(int cacheSize)
Creates a new LRU cache.

パラメータ:
cacheSize - the maximum number of entries that will be kept in this cache.
メソッドの詳細

get

public V get(K key)
Retrieves an entry from the cache.
The retrieved entry becomes the MRU (most recently used) entry.

パラメータ:
key - the key whose associated value is to be returned.
戻り値:
the value associated to this key, or null if no value with this key exists in the cache.

put

public void put(K key,
                V value)
Adds an entry to this cache. The new entry becomes the MRU (most recently used) entry. If an entry with the specified key already exists in the cache, it is replaced by the new entry. If the cache is full, the LRU (least recently used) entry is removed from the cache.

パラメータ:
key - the key with which the specified value is to be associated.
value - a value to be associated with the specified key.

clear

public void clear()
Clears the cache.


usedEntries

public int usedEntries()
Returns the number of used entries in the cache.

戻り値:
the number of entries currently in the cache.

getAll

public java.util.Collection<java.util.Map.Entry<K,V>> getAll()
Returns a Collection that contains a copy of all cache entries.

戻り値:
a Collection with a copy of the cache content.