public class MruList
extends java.lang.Object
implements java.util.Set
| Modifier and Type | Class and Description |
|---|---|
protected static class |
MruList.MruEntry
Represent an entry in the MruList
|
protected static class |
MruList.MruIterator
An iterator to the entries
|
| Modifier and Type | Field and Description |
|---|---|
private java.util.HashMap |
_entryMap
the entries map *
|
private long |
_lastCleanupTime
the last cleanup time *
|
private java.util.TreeSet |
_mruList
the sorted mru list *
|
private long |
_sizeLimit
the size *
|
private long |
_timeout
the timeout *
|
| Constructor and Description |
|---|
MruList() |
MruList(long sizeLimit,
long timeout) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
access(java.lang.Object o)
Record that object o is being accessed.
|
boolean |
add(java.lang.Object o) |
boolean |
addAll(java.util.Collection c) |
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection c) |
void |
expireEntries(long t)
Expire the entries that was last access longer that time t Document this method.
|
protected void |
expireEntry(java.lang.Object obj)
Remove the entry from the MruList
|
long |
getLastAccessTime(java.lang.Object obj)
Get the last access time object obj
|
boolean |
isEmpty() |
java.util.Iterator |
iterator() |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection c) |
boolean |
retainAll(java.util.Collection c) |
int |
size() |
java.lang.Object[] |
toArray() |
java.lang.Object[] |
toArray(java.lang.Object[] a) |
void |
truncateEntries(long size)
Truncate the entries to specific size
|
protected void |
truncateEntry(java.lang.Object obj)
Remove the object from the MruList
|
private java.util.HashMap _entryMap
private long _lastCleanupTime
private java.util.TreeSet _mruList
private long _sizeLimit
private long _timeout
public MruList()
public MruList(long sizeLimit,
long timeout)
sizeLimit - the size limit of the MruList (0 for no size limit)timeout - the timeout (0 for never timeout)public boolean access(java.lang.Object o)
o - the objectpublic boolean add(java.lang.Object o)
add in interface java.util.Collectionadd in interface java.util.Setaccess(Object o)public boolean addAll(java.util.Collection c)
addAll in interface java.util.CollectionaddAll in interface java.util.Setpublic void clear()
clear in interface java.util.Collectionclear in interface java.util.Setpublic boolean contains(java.lang.Object o)
contains in interface java.util.Collectioncontains in interface java.util.Setpublic boolean containsAll(java.util.Collection c)
containsAll in interface java.util.CollectioncontainsAll in interface java.util.Setpublic void expireEntries(long t)
t - the elapse timepublic long getLastAccessTime(java.lang.Object obj)
obj - the objectpublic boolean isEmpty()
isEmpty in interface java.util.CollectionisEmpty in interface java.util.Setpublic java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in interface java.util.Setpublic boolean remove(java.lang.Object o)
remove in interface java.util.Collectionremove in interface java.util.Setpublic boolean removeAll(java.util.Collection c)
removeAll in interface java.util.CollectionremoveAll in interface java.util.Setpublic boolean retainAll(java.util.Collection c)
retainAll in interface java.util.CollectionretainAll in interface java.util.Setpublic int size()
size in interface java.util.Collectionsize in interface java.util.Setpublic java.lang.Object[] toArray()
toArray in interface java.util.CollectiontoArray in interface java.util.Setpublic java.lang.Object[] toArray(java.lang.Object[] a)
toArray in interface java.util.CollectiontoArray in interface java.util.Setpublic void truncateEntries(long size)
size - the sizeprotected void truncateEntry(java.lang.Object obj)
obj - the objectprotected void expireEntry(java.lang.Object obj)
obj - expire the entry