net.siefkes.nlstego.util
Class ExtendedLRUMap
java.lang.Object
java.util.AbstractMap
org.apache.commons.collections.map.AbstractHashedMap
org.apache.commons.collections.map.AbstractLinkedMap
org.apache.commons.collections.map.LRUMap
net.siefkes.nlstego.util.ExtendedLRUMap
- All Implemented Interfaces:
- Serializable, Cloneable, Map, BoundedMap, IterableMap, OrderedMap
public class ExtendedLRUMap
- extends LRUMap
An extension of the LRUMap that also allows transparent (invisible) read
operations which do not modify the access order of the map entries.
- Version:
- $Revision: 1.2 $, $Date: 2005/07/12 17:02:22 $, $Author: siefkes $
- Author:
- Christian Siefkes
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
| Fields inherited from class org.apache.commons.collections.map.AbstractHashedMap |
data, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_THRESHOLD, entrySet, GETKEY_INVALID, GETVALUE_INVALID, keySet, loadFactor, MAXIMUM_CAPACITY, modCount, NO_NEXT_ENTRY, NO_PREVIOUS_ENTRY, NULL, REMOVE_INVALID, SETVALUE_INVALID, size, threshold, values |
|
Constructor Summary |
ExtendedLRUMap()
Creates a new instance. |
ExtendedLRUMap(int maxSize)
Creates a new instance. |
ExtendedLRUMap(int maxSize,
boolean scanUntilRemovable)
Creates a new instance. |
ExtendedLRUMap(int maxSize,
float loadFactor)
Creates a new instance. |
ExtendedLRUMap(int maxSize,
float loadFactor,
boolean scanUntilRemovable)
Creates a new instance. |
ExtendedLRUMap(Map map)
Constructor copying elements from another map. |
ExtendedLRUMap(Map map,
boolean scanUntilRemovable)
Constructor copying elements from another map. |
| Methods inherited from class org.apache.commons.collections.map.LRUMap |
addMapping, clone, doReadObject, doWriteObject, get, isFull, isScanUntilRemovable, maxSize, moveToMRU, removeLRU, reuseMapping, updateEntry |
| Methods inherited from class org.apache.commons.collections.map.AbstractLinkedMap |
addEntry, clear, containsValue, createEntry, createEntrySetIterator, createKeySetIterator, createValuesIterator, entryAfter, entryBefore, firstKey, getEntry, init, lastKey, mapIterator, nextKey, orderedMapIterator, previousKey, removeEntry |
| Methods inherited from class org.apache.commons.collections.map.AbstractHashedMap |
calculateNewCapacity, calculateThreshold, checkCapacity, containsKey, convertKey, destroyEntry, ensureCapacity, entryHashCode, entryKey, entryNext, entrySet, entryValue, equals, getEntry, hash, hashCode, hashIndex, isEmpty, isEqualKey, isEqualValue, keySet, put, putAll, remove, removeMapping, reuseEntry, size, toString, values |
| Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
ExtendedLRUMap
public ExtendedLRUMap()
- Creates a new instance.
ExtendedLRUMap
public ExtendedLRUMap(int maxSize)
- Creates a new instance.
- Parameters:
maxSize - the maximum size of the map
ExtendedLRUMap
public ExtendedLRUMap(int maxSize,
boolean scanUntilRemovable)
- Creates a new instance.
- Parameters:
maxSize - the maximum size of the mapscanUntilRemovable - scan until a removeable entry is found, default
false
ExtendedLRUMap
public ExtendedLRUMap(int maxSize,
float loadFactor)
- Creates a new instance.
- Parameters:
maxSize - the maximum size of the maploadFactor - the load factor
ExtendedLRUMap
public ExtendedLRUMap(int maxSize,
float loadFactor,
boolean scanUntilRemovable)
- Creates a new instance.
- Parameters:
maxSize - the maximum size of the maploadFactor - the load factorscanUntilRemovable - scan until a removeable entry is found, default
false
ExtendedLRUMap
public ExtendedLRUMap(Map map)
- Constructor copying elements from another map.
The maximum size is set from the map's size.
- Parameters:
map - the map to copy
ExtendedLRUMap
public ExtendedLRUMap(Map map,
boolean scanUntilRemovable)
- Constructor copying elements from another map.
The maximum size is set from the map's size.
- Parameters:
map - the map to copyscanUntilRemovable - scan until a removeable entry is found, default
false
transparentGet
public Object transparentGet(Object key)
- Returns the value to the specified key, without changing the LRU
structure. Use this instead of
get, if you want to make
an "invisible" request that is ignored by the replacement algorithm.
- Parameters:
key - the key to look up
- Returns:
- the mapped value,
null if no match
Copyright © 2003-2005 Christian Siefkes. All Rights Reserved.