org.w3c.util
Class LRUList

java.lang.Object
  extended by org.w3c.util.LRUList
Direct Known Subclasses:
AsyncLRUList, SyncLRUList

public abstract class LRUList
extends java.lang.Object


Field Summary
protected  LRUNode head
           
protected  LRUNode tail
           
 
Constructor Summary
LRUList()
           
 
Method Summary
abstract  LRUAble getHead()
          Obtain the frontmost node.
abstract  LRUAble getNext(LRUAble node)
          Get the next node of this list.
abstract  LRUAble getPrev(LRUAble node)
          Get the previous node of this list.
abstract  LRUAble getTail()
          Obtain the backmost node.
abstract  LRUAble remove(LRUAble node)
          Removes node if it's in list.
abstract  LRUAble removeTail()
          Obtain the backmost node, and remove it from list too.
abstract  void toHead(LRUAble node)
          Moves node to front of list.
abstract  void toTail(LRUAble node)
          Moves node to back of list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

head

protected LRUNode head

tail

protected LRUNode tail
Constructor Detail

LRUList

public LRUList()
Method Detail

toHead

public abstract void toHead(LRUAble node)
Moves node to front of list. It can be a new node, or it can be an existing node.

Parameters:
node - the node

toTail

public abstract void toTail(LRUAble node)
Moves node to back of list. It can be a new node, or it can be an existing node.

Parameters:
node - the node

remove

public abstract LRUAble remove(LRUAble node)
Removes node if it's in list. Does nothing if it's not. When a node is removed, both its links are set to null.

Parameters:
node - The node to remove
Returns:
the same node

getTail

public abstract LRUAble getTail()
Obtain the backmost node.

Returns:
the backmost node, or null if list is empty

getHead

public abstract LRUAble getHead()
Obtain the frontmost node.

Returns:
the frontmost node, or null if list is empty

removeTail

public abstract LRUAble removeTail()
Obtain the backmost node, and remove it from list too.

Returns:
the backmost node, or null if list is empty

getNext

public abstract LRUAble getNext(LRUAble node)
Get the next node of this list.

Returns:
The next node, or null if this one was last.

getPrev

public abstract LRUAble getPrev(LRUAble node)
Get the previous node of this list.

Returns:
The previous node, or null if this one was last.