net.siefkes.nlstego.util
Class ExtendedLRUMap

java.lang.Object
  extended by java.util.AbstractMap
      extended by org.apache.commons.collections.map.AbstractHashedMap
          extended by org.apache.commons.collections.map.AbstractLinkedMap
              extended by org.apache.commons.collections.map.LRUMap
                  extended by 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 Class Summary
 
Nested classes/interfaces inherited from class org.apache.commons.collections.map.AbstractLinkedMap
AbstractLinkedMap.EntrySetIterator, AbstractLinkedMap.KeySetIterator, AbstractLinkedMap.LinkEntry, AbstractLinkedMap.LinkIterator, AbstractLinkedMap.LinkMapIterator, AbstractLinkedMap.ValuesIterator
 
Nested classes/interfaces inherited from class org.apache.commons.collections.map.AbstractHashedMap
AbstractHashedMap.EntrySet, AbstractHashedMap.HashEntry, AbstractHashedMap.HashIterator, AbstractHashedMap.HashMapIterator, AbstractHashedMap.KeySet, AbstractHashedMap.Values
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class org.apache.commons.collections.map.LRUMap
DEFAULT_MAX_SIZE
 
Fields inherited from class org.apache.commons.collections.map.AbstractLinkedMap
header
 
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.
 
Method Summary
 Object transparentGet(Object key)
          Returns the value to the specified key, without changing the LRU structure.
 
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 class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Constructor Detail

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 map
scanUntilRemovable - 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 map
loadFactor - the load factor

ExtendedLRUMap

public ExtendedLRUMap(int maxSize,
                      float loadFactor,
                      boolean scanUntilRemovable)
Creates a new instance.

Parameters:
maxSize - the maximum size of the map
loadFactor - the load factor
scanUntilRemovable - 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 copy
scanUntilRemovable - scan until a removeable entry is found, default false
Method Detail

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.