|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.pentaho.reporting.libraries.base.util.LFUMap
public class LFUMap
A Least-Frequently-Used Map.
This is not a real map in the sense of the Java-Collections-API. This is a slimmed down version of a Least-Frequently-Used map with no unnecessary extra stuff like iterators or other costly but rarely used java.util.Collections features. The cache does not accept null-keys, and any attempt to store null-values will yield an error. To remove a couple of ugly checks and thus improving performance, this map enforces a minimum size of 3 items.
| Constructor Summary | |
|---|---|
LFUMap(int cacheSize)
Creates a new LFU-Map with a maximum size of cacheSize entries. |
|
| Method Summary | |
|---|---|
void |
clear()
|
java.lang.Object |
clone()
|
java.lang.Object |
get(java.lang.Object key)
Return the entry for the given key. |
int |
getMaximumSize()
Returns the defined maximum size. |
boolean |
isEmpty()
Checks whether this map is empty. |
void |
put(java.lang.Object key,
java.lang.Object value)
Puts the given value into the map using the specified non-null key. |
void |
remove(java.lang.Object key)
Removes the entry for the given key. |
int |
size()
Returns the number of items in this map. |
void |
validate()
Validates the map's internal datastructures. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LFUMap(int cacheSize)
cacheSize entries.
cacheSize - the maximum number of elements this map will be able to store.| Method Detail |
|---|
public void clear()
public java.lang.Object get(java.lang.Object key)
key - the lookup key.
public void put(java.lang.Object key,
java.lang.Object value)
key - the key.value - the value.public void remove(java.lang.Object key)
key - the key for which an entry should be removed.public int size()
public boolean isEmpty()
public int getMaximumSize()
public void validate()
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||