|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
edu.pdx.cs399J.AbstractLRUMap<K,V>
public abstract class AbstractLRUMap<K,V>
This is the abstract superclass of an "LRU Map". An LRU Map is a
Java Map that has a bounded number of mappings. If a new
mapping is added to an LRU Map that already has the maximum number
of mappings, then the least recently used mapping is removed. An
element is used when it is added to or gotten from the Map.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Field Summary | |
|---|---|
protected int |
capacity
The maximum number of mappings that this map can hold |
| Constructor Summary | |
|---|---|
protected |
AbstractLRUMap(int capacity)
Creates a new LRU Map that will hold a given number of mappings |
| Method Summary | |
|---|---|
abstract void |
clear()
|
abstract V |
get(Object key)
Getting an element from a map marks the mapping as "used". |
abstract List<String> |
getStudentNames()
Returns the names of the students who implemented this LRU Map. |
abstract V |
put(K key,
V value)
When a mapping is made in an LRU that already contains the maximum number of mappings, the Least Recently Used element is removed. |
void |
putAll(Map<? extends K,? extends V> map)
|
abstract V |
remove(Object key)
Removes the given key from this map. |
| Methods inherited from class java.util.AbstractMap |
|---|
clone, containsKey, containsValue, entrySet, equals, hashCode, isEmpty, keySet, size, toString, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int capacity
| Constructor Detail |
|---|
protected AbstractLRUMap(int capacity)
capacity - The maximum number of mappings in this map
IllegalArgumentException - capacity is negative| Method Detail |
|---|
public abstract List<String> getStudentNames()
public abstract V put(K key,
V value)
put in interface Map<K,V>put in class AbstractMap<K,V>public abstract V get(Object key)
key must be Object
so that, after type erasure, it will be compatible with the
pre-generic API.
get in interface Map<K,V>get in class AbstractMap<K,V>public abstract V remove(Object key)
key must be Object so that, after type
erasure, it will be compatible with the pre-generic API.
remove in interface Map<K,V>remove in class AbstractMap<K,V>public void putAll(Map<? extends K,? extends V> map)
putAll in interface Map<K,V>putAll in class AbstractMap<K,V>public abstract void clear()
clear in interface Map<K,V>clear in class AbstractMap<K,V>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||