|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ostore.util.LruMap
LruMap
is a Map
with an attached LRU
ordering.
Constructor Summary | |
---|---|
LruMap(int cap,
Map backing_map)
Constructor: Creates a new LruMap . |
Method Summary | |
---|---|
Map |
backing_map()
backing_up |
int |
capacity()
capacity returns max capacity for the LruMap . |
boolean |
containsKey(Object key)
Specified by java.util.Map |
Object |
get(Object key)
Specified by java.util.Map |
boolean |
isEmpty()
Specified by java.util.Map |
boolean |
isFull()
isFull returns true if LruMap is at full
capacity; otherwise, false. |
Iterator |
iterator()
iterator returns an Iterator that
walks through the set of items in the Map ,
starting with the most recently added to the least recently used. |
Set |
keySet()
Specified by java.util.Map |
Object |
lastKey()
|
Pair |
put(Object key,
Object value)
If the LruMap isFull (i.e. at full
capacity() , than put returns
a Pair of victim key /value ;
otherwise, put returns null .
|
Object |
remove(Object key)
Specified by java.util.Map |
int |
size()
Specified by java.util.Map |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LruMap(int cap, Map backing_map)
LruMap
.
cap
- Maximum capacity for Map
.backing_map
- Actual Map
used to store entries.Method Detail |
public int capacity()
capacity
returns max capacity for the LruMap
.
LruMap
.public int size()
public Set keySet()
public boolean containsKey(Object key)
public boolean isEmpty()
public boolean isFull()
isFull
returns true if LruMap
is at full
capacity; otherwise, false.
LruMap
is at full
capacity; otherwise, false.public Map backing_map()
backing_up
Map
used to store entries.public Iterator iterator()
iterator
returns an Iterator
that
walks through the set of items in the Map
,
starting with the most recently added to the least recently used.
Iterator
with an attached LRU ordering.public Pair put(Object key, Object value)
LruMap
isFull
(i.e. at full
capacity()
, than put
returns
a Pair
of victim key
/value
;
otherwise, put
returns null
.
In either case the new key
/value
pair
is placed in the LruMap
key
- Key to place in LruMap
.value
- Value to place in LruMap
.
Pair
of victim key
/
value
if LruMap
was full;
otherwise, return null
.public Object get(Object key)
public Object lastKey()
public Object remove(Object key)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |