Extension SDK

oracle.ide.util
Class LRU

java.lang.Object
  extended byoracle.ide.util.LRU

Deprecated. since 9.0.3.811: No longer used

public class LRU
extends java.lang.Object

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

LRU

public LRU()
Deprecated. 
Method Detail

insertAt

public void insertAt(int index)
Deprecated. 
Tells the LRU that a new element has been added at the specified position. The inserted element is pushed at the end of the LRU (considered as it has never been used)


add

public void add()
Deprecated. 
Tells the LRU that a new element has been added at the end of the list. The inserted element is pushed at the end of the LRU (considered as it has never been used)


removeAt

public void removeAt(int index)
Deprecated. 
Tells the LRU that an element has been removed from the specified position.


removeAll

public void removeAll()
Deprecated. 
Tells the LRU that all the elements have been removed.


use

public void use(int index)
Deprecated. 
Moves the specified position at the top (indice 0) of the usage list.


getAll

public int[] getAll()
Deprecated. 
Gets the LRU status. The most recently used element is at position 0.


Extension SDK

 

Copyright ©1997, 2003, Oracle. All rights reserved.