|
Extension SDK | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectoracle.ide.util.LRU
This class maintains a list of indexes in the last-recently-used order. The LRU refers to indexes of object in your list. For example:
class MyClass
{
ArrayList _objects = new ArrayList();
LRU _lru = new LRU();
public void insertAt(int pos, Object obj)
{
_objects.add(pos, obj);
_lru.insertAt(pos);
}
public void removeAt(int pos)
{
_objects.remove(pos);
_lru.removeAt(pos);
}
public Object get(int pos)
{
_lru.use(pos);
return _objects.get(pos);
}
public Object lastGet()
{
int[] usage = _lru.getAll();
int lastUsed = usage[0];
return _objects.get(lastUsed);
}
}
| Constructor Summary | |
LRU()
Deprecated. |
|
| Method Summary | |
void |
add()
Deprecated. Tells the LRU that a new element has been added at the end of the list. |
int[] |
getAll()
Deprecated. Gets the LRU status. |
void |
insertAt(int index)
Deprecated. Tells the LRU that a new element has been added at the specified position. |
void |
removeAll()
Deprecated. Tells the LRU that all the elements have been removed. |
void |
removeAt(int index)
Deprecated. Tells the LRU that an element has been removed from the specified position. |
void |
use(int index)
Deprecated. Moves the specified position at the top (indice 0) of the usage list. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public LRU()
| Method Detail |
public void insertAt(int index)
public void add()
public void removeAt(int index)
public void removeAll()
public void use(int index)
public int[] getAll()
|
Extension SDK | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright ©1997, 2003, Oracle. All rights reserved.