Jadex 0.96-beta1

jadex.util.collection
Class LRU

java.lang.Object
  extended by java.util.AbstractMap
      extended by java.util.HashMap
          extended by java.util.LinkedHashMap
              extended by jadex.util.collection.LRU
All Implemented Interfaces:
Serializable, Cloneable, Map

public class LRU
extends LinkedHashMap

A least recently used map.

See Also:
Serialized Form

Constructor Summary
LRU(int max)
          Create a new LRU.
LRU(int max, ILRUEntryCleaner cleaner)
          Create a new LRU.
 
Method Summary
 int getMaxEntries()
          Get the maximum number of the
 boolean removeEldestEntry(Map.Entry eldest)
          Remove the eldest entry.
 void setCleaner(ILRUEntryCleaner cleaner)
          Set the cleaner object.
 void setMaxEntries(int max)
          Set the maximum number of entries.
 
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, get
 
Methods inherited from class java.util.HashMap
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
containsKey, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Constructor Detail

LRU

public LRU(int max)
Create a new LRU.

Parameters:
max - The maximum number of entries.

LRU

public LRU(int max,
           ILRUEntryCleaner cleaner)
Create a new LRU.

Parameters:
max - The maximum number of entries.
Method Detail

getMaxEntries

public int getMaxEntries()
Get the maximum number of the

Returns:
The maximum number of entries.

setMaxEntries

public void setMaxEntries(int max)
Set the maximum number of entries.

Parameters:
max - The maximum number of entries.

setCleaner

public void setCleaner(ILRUEntryCleaner cleaner)
Set the cleaner object.

Parameters:
cleaner - The cleaner object.

removeEldestEntry

public boolean removeEldestEntry(Map.Entry eldest)
Remove the eldest entry.

Overrides:
removeEldestEntry in class LinkedHashMap
Parameters:
eldest - The eldest entry.
Returns:
True if need to be removed.

Jadex 0.96-beta1

Submit a bug or feature
For further API reference and developer documentation, see the Jadex User Guide and the Jadex Tutorial. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, and working code examples.

Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.