org.jboss.cache.eviction
Class MRUQueue

java.lang.Object
  extended by org.jboss.cache.eviction.MRUQueue
All Implemented Interfaces:
EvictionQueue

public class MRUQueue
extends java.lang.Object
implements EvictionQueue

MRU Eviction Queue implementation.

This nodeMap is sorted by MRU. The first entry in the nodeMap will also be the most recently used entry. The sort is implicit based on a Stack that we can implicitly sort to the top by moving a node that is used to the top of the eviction stack.

Version:
$Revision: 1.2 $
Author:
Daniel Huang (dhuang@jboss.org)

Method Summary
 void addNodeEntry(NodeEntry entry)
          Add a NodeEntry to the queue.
 void clear()
          Clear the queue.
 boolean containsNodeEntry(NodeEntry entry)
          Check if queue contains the given NodeEntry.
 NodeEntry getFirstNodeEntry()
          Will return the first entry in the nodeMap.
 NodeEntry getNodeEntry(Fqn fqn)
          Retrieve a node entry by Fqn.
 NodeEntry getNodeEntry(java.lang.String fqn)
           
 void removeNodeEntry(NodeEntry entry)
          Remove a NodeEntry from queue.
 int size()
          Get the size of the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFirstNodeEntry

public NodeEntry getFirstNodeEntry()
Will return the first entry in the nodeMap.

The first entry in this nodeMap will also be the most recently used entry.

Specified by:
getFirstNodeEntry in interface EvictionQueue
Returns:
The first node entry in nodeMap.

getNodeEntry

public NodeEntry getNodeEntry(Fqn fqn)
Description copied from interface: EvictionQueue
Retrieve a node entry by Fqn.

This will return null if the entry is not found.

Specified by:
getNodeEntry in interface EvictionQueue
Parameters:
fqn - Fqn of the node entry to retrieve.
Returns:
Node Entry object associated with given Fqn param.

getNodeEntry

public NodeEntry getNodeEntry(java.lang.String fqn)
Specified by:
getNodeEntry in interface EvictionQueue

containsNodeEntry

public boolean containsNodeEntry(NodeEntry entry)
Description copied from interface: EvictionQueue
Check if queue contains the given NodeEntry.

Specified by:
containsNodeEntry in interface EvictionQueue
Parameters:
entry - NodeEntry to check for existence in queue.
Returns:
true/false if NodeEntry exists in queue.

removeNodeEntry

public void removeNodeEntry(NodeEntry entry)
Description copied from interface: EvictionQueue
Remove a NodeEntry from queue.

If the NodeEntry does not exist in the queue, this method will return normally.

Specified by:
removeNodeEntry in interface EvictionQueue
Parameters:
entry - The NodeEntry to remove from queue.

addNodeEntry

public void addNodeEntry(NodeEntry entry)
Description copied from interface: EvictionQueue
Add a NodeEntry to the queue.

Specified by:
addNodeEntry in interface EvictionQueue
Parameters:
entry - The NodeEntry to add to queue.

size

public int size()
Description copied from interface: EvictionQueue
Get the size of the queue.

Specified by:
size in interface EvictionQueue
Returns:
The number of items in the queue.

clear

public void clear()
Description copied from interface: EvictionQueue
Clear the queue.

Specified by:
clear in interface EvictionQueue


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.