org.exolab.castor.persist
Class LRU.CountLimited
- LRU
public static class LRU.CountLimited
CountLimited is a count limted least-recently-used
Map.
Every object being put in the Map will live until the
map is full. If the map is full, a least-recently-used object
will be disposed.
Method
dispose(Object)
will be called whenever an
old object is diposed. Developer can get notify by overriding
the dispose method
dispose(Object)
.
protected void | dispose(Object o) - This method is called when an object is disposed.
|
Enumeration | elements() - Returns an enumeration of the values in this LRU map.
|
Object | get(Object key) - Returns the value to which the specified key is mapped in this Map.
|
Object | put(Object key, Object object) - Maps the specified
key to the specified
value in this Map.
|
Object | remove(Object key) - Removes the key (and its corresponding value) from this
Map.
|
CountLimited
public CountLimited(int size)
dispose
protected void dispose(Object o)
This method is called when an object is disposed.
Override this method if you interested in the disposed object.
o
- - the disposed object
elements
public Enumeration elements()
Returns an enumeration of the values in this LRU map.
Use the Enumeration methods on the returned object to fetch the elements
sequentially.
- elements in interface LRU
- an enumeration of the values in this Map.
get
public Object get(Object key)
Returns the value to which the specified key is mapped in this Map.
- get in interface LRU
key
- - a key in the Map.
- the value to which the key is mapped in this Map; null if
the key is not mapped to any value in this Map.
put
public Object put(Object key,
Object object)
Maps the specified
key
to the specified
value
in this Map. Neither the key nor the
value can be
null
.
The value can be retrieved by calling the
get
method
with a key that is equal to the original key, before it is diposed
when the Map is full.
- put in interface LRU
- the previous value of the specified key in this Map,
or
null
if it did not have one.
remove
public Object remove(Object key)
Removes the key (and its corresponding value) from this
Map. This method does nothing if the key is not in the Map.
- remove in interface LRU
key
- the key that needs to be removed.
- the value to which the key had been mapped in this Map,
or
null
if the key did not have a mapping.
Intalio Inc. (C) 1999-2003. All rights reserved http://www.intalio.com