Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 41   Methods: 3
NCLOC: 20   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
MRUAlgorithm.java - 100% 100% 100%
coverage
 1    /*
 2    * JBoss, the OpenSource J2EE webOS
 3    *
 4    * Distributable under LGPL license.
 5    * See terms of license at gnu.org.
 6    */
 7    package org.jboss.cache.eviction;
 8   
 9    import org.jboss.cache.Fqn;
 10    import org.jboss.cache.Region;
 11   
 12    /**
 13    * Most Recently Used Algorithm.
 14    * <p/>
 15    * This algorithm will evict the most recently used cache entries from cache.
 16    * <p/>
 17    * Note: None of the Eviction classes are thread safe. It is assumed that an individual instance of an EvictionPolicy/
 18    * EvictionAlgorithm/EvictionQueue/EvictionConfiguration are only operated on by one thread at any given time.
 19    *
 20    * @author Daniel Huang (dhuang@jboss.org)
 21    * @version $Revision: 1.4 $
 22    */
 23    public class MRUAlgorithm extends BaseEvictionAlgorithm
 24    {
 25  11 protected EvictionQueue setupEvictionQueue(Region region) throws EvictionException
 26    {
 27  11 return new MRUQueue();
 28    }
 29   
 30  10342 protected boolean shouldEvictNode(NodeEntry ne)
 31    {
 32  10342 MRUConfiguration config = (MRUConfiguration) region.getEvictionPolicyConfig();
 33  10342 return evictionQueue.getNumberOfNodes() > config.getMaxNodes();
 34    }
 35   
 36  4 protected void processVisitedNodes(Fqn fqn) throws EvictionException
 37    {
 38  4 super.processVisitedNodes(fqn);
 39  4 ((MRUQueue) evictionQueue).moveToTopOfStack(fqn);
 40    }
 41    }