|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.onemind.commons.java.datastructure.MruList
Most recently used list implementation. It support entries expiration by access time.
Nested Class Summary | |
protected static class |
MruList.MruEntry
Represent an entry in the MruList |
protected static class |
MruList.MruIterator
An iterator to the entries |
Constructor Summary | |
MruList()
{@inheritDoc} |
|
MruList(long sizeLimit,
long timeout)
{@inheritDoc} |
Method Summary | |
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 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Set |
equals, hashCode |
Constructor Detail |
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)Method Detail |
public boolean access(java.lang.Object o)
o
- the object
public boolean add(java.lang.Object o)
add
in interface java.util.Set
access(Object o)
public boolean addAll(java.util.Collection c)
addAll
in interface java.util.Set
public void clear()
clear
in interface java.util.Set
public boolean contains(java.lang.Object o)
contains
in interface java.util.Set
public boolean containsAll(java.util.Collection c)
containsAll
in interface java.util.Set
public void expireEntries(long t)
t
- the elapse timepublic long getLastAccessTime(java.lang.Object obj)
obj
- the object
public boolean isEmpty()
isEmpty
in interface java.util.Set
public java.util.Iterator iterator()
iterator
in interface java.util.Set
public boolean remove(java.lang.Object o)
remove
in interface java.util.Set
public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Set
public boolean retainAll(java.util.Collection c)
retainAll
in interface java.util.Set
public int size()
size
in interface java.util.Set
public java.lang.Object[] toArray()
toArray
in interface java.util.Set
public java.lang.Object[] toArray(java.lang.Object[] a)
toArray
in interface java.util.Set
public 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
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |