Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 52   Methods: 3
NCLOC: 26   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
FIFOAlgorithm.java 50% 85.7% 100% 83.3%
coverage 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.apache.commons.logging.Log;
 10    import org.apache.commons.logging.LogFactory;
 11    import org.jboss.cache.Region;
 12   
 13    /**
 14    * First-in-first-out algorithm used to evict nodes.
 15    *
 16    * @author Daniel Huang - dhuang@jboss.org
 17    * @author Morten Kvistgaard
 18    * @version $Revision: 1.7 $
 19    */
 20    public class FIFOAlgorithm extends BaseEvictionAlgorithm
 21    {
 22    private static final Log log = LogFactory.getLog(FIFOAlgorithm.class);
 23   
 24   
 25  52 public FIFOAlgorithm()
 26    {
 27  52 super();
 28    }
 29   
 30  22 protected EvictionQueue setupEvictionQueue(Region region) throws EvictionException
 31    {
 32  22 return new FIFOQueue();
 33    }
 34   
 35    /**
 36    * For FIFO, a node should be evicted if the queue size is >= to the configured maxNodes size.
 37    */
 38  15605 protected boolean shouldEvictNode(NodeEntry ne)
 39    {
 40  15605 FIFOConfiguration config = (FIFOConfiguration) region.getEvictionPolicyConfig();
 41  15605 if (log.isTraceEnabled())
 42    {
 43  0 log.trace("Deciding whether node in queue " + ne.getFqn() + " requires eviction.");
 44    }
 45   
 46  15605 int size = this.getEvictionQueue().getNumberOfNodes();
 47  15605 return config.getMaxNodes() != 0 && size > config.getMaxNodes();
 48   
 49    }
 50   
 51    }
 52