|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap
org.apache.commons.collections.map.AbstractHashedMap
org.apache.commons.collections.map.AbstractLinkedMap
org.apache.commons.collections.map.LRUMap
de.fu_berlin.ties.util.AdaptableLRUMap
public class AdaptableLRUMap
A fixed-size map that uses an flexible adaptable strategy for pruning entries based on LRU (pruning one the least recently used entries). Instances of this class are not thread-safe and must be synchronized externally, if required.
Nested Class Summary |
---|
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 | |
---|---|
AdaptableLRUMap(int maxSize,
float loadFactor,
Pruner prun,
int candidates,
int pruneNum)
Constructs a new, empty map with the specified initial capacity and load factor. |
|
AdaptableLRUMap(int maxSize,
Pruner prun,
int candidates,
int pruneNum)
Constructs a new, empty map with the specified initial capacity and the default load factor. |
Method Summary | |
---|---|
int |
getCandidateNumber()
Returns the number of candidates considered for each pruning operation. |
int |
getPruneNumber()
Returns the number of elements removed by each pruning operation. |
protected boolean |
removeLRU(org.apache.commons.collections.map.AbstractLinkedMap.LinkEntry entry)
Controls removal of one of the least recently used entries from the map. |
Methods inherited from class org.apache.commons.collections.map.LRUMap |
---|
addMapping, clone, doReadObject, doWriteObject, get, isFull, isScanUntilRemovable, maxSize, moveToMRU, 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 |
---|
public AdaptableLRUMap(int maxSize, Pruner prun, int candidates, int pruneNum) throws IllegalArgumentException
LRUMap
; otherwise the
Pruner
is consulted to decide which entry to prune.
maxSize
- the maximum size of the mapprun
- Used to decide which entries to prunecandidates
- The number of candidates to consider for each pruning
operationpruneNum
- The number of elements to remove by each pruning
operation, must not be larger than candidates
IllegalArgumentException
- if one of the input parameters is
invalidpublic AdaptableLRUMap(int maxSize, float loadFactor, Pruner prun, int candidates, int pruneNum) throws IllegalArgumentException
LRUMap
; otherwise the
Pruner
is consulted to decide which entry to prune.
maxSize
- the maximum size of the maploadFactor
- the load factorprun
- Used to decide which entries to prunecandidates
- The number of candidates to consider for each pruning
operationpruneNum
- The number of elements to remove by each pruning
operation, must not be larger than candidates
IllegalArgumentException
- if one of the input parameters is
invalidMethod Detail |
---|
public int getCandidateNumber()
public int getPruneNumber()
protected boolean removeLRU(org.apache.commons.collections.map.AbstractLinkedMap.LinkEntry entry)
removeLRU
in class org.apache.commons.collections.map.LRUMap
entry
- the least recently used entry
true
if the superclass should delete the
specified entry; false
if this class took the necessary
action by deleting the first getPruneNumber()
entries selected
by the pruner
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |