org.apache.openjpa.lib.util
Class LRUMap

java.lang.Object
  extended by org.apache.commons.collections.map.LRUMap
      extended by org.apache.openjpa.lib.util.LRUMap
All Implemented Interfaces:
Map, SizedMap

public class LRUMap
extends LRUMap
implements SizedMap

Extension of the commons LRUMap that can change its maximum size.

Author:
Abe White

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
LRUMap()
           
LRUMap(int maxSize)
           
LRUMap(int maxSize, float loadFactor)
           
LRUMap(Map map)
           
 
Method Summary
protected  void doReadObject(ObjectInputStream in)
           
protected  void doWriteObject(ObjectOutputStream out)
           
 int getMaxSize()
          The maximum number of entries, or Integer.MAX_VALUE for no limit.
 boolean isFull()
          Whether the map is full.
 int maxSize()
           
 void overflowRemoved(Object key, Object value)
          Overridable callback for when an overflow entry is automatically removed.
protected  boolean removeLRU(LinkEntry entry)
           
 void setMaxSize(int max)
          The maximum number of entries, or Integer.MAX_VALUE for no limit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Constructor Detail

LRUMap

public LRUMap()

LRUMap

public LRUMap(int maxSize)

LRUMap

public LRUMap(int maxSize,
              float loadFactor)

LRUMap

public LRUMap(Map map)
Method Detail

getMaxSize

public int getMaxSize()
Description copied from interface: SizedMap
The maximum number of entries, or Integer.MAX_VALUE for no limit.

Specified by:
getMaxSize in interface SizedMap

setMaxSize

public void setMaxSize(int max)
Description copied from interface: SizedMap
The maximum number of entries, or Integer.MAX_VALUE for no limit.

Specified by:
setMaxSize in interface SizedMap

overflowRemoved

public void overflowRemoved(Object key,
                            Object value)
Description copied from interface: SizedMap
Overridable callback for when an overflow entry is automatically removed.

Specified by:
overflowRemoved in interface SizedMap

maxSize

public int maxSize()

isFull

public boolean isFull()
Description copied from interface: SizedMap
Whether the map is full.

Specified by:
isFull in interface SizedMap

removeLRU

protected boolean removeLRU(LinkEntry entry)

doWriteObject

protected void doWriteObject(ObjectOutputStream out)
                      throws IOException
Throws:
IOException

doReadObject

protected void doReadObject(ObjectInputStream in)
                     throws IOException,
                            ClassNotFoundException
Throws:
IOException
ClassNotFoundException


Copyright © 2006 Apache Software Foundation. All Rights Reserved.