Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 45   Methods: 3
NCLOC: 24   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ElementSizeAlgorithm.java 100% 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.Region;
 10   
 11   
 12    /**
 13    * @author Daniel Huang
 14    * @version $Revision: 1.3 $
 15    */
 16    public class ElementSizeAlgorithm extends BaseSortedEvictionAlgorithm
 17    {
 18  14 protected EvictionQueue setupEvictionQueue(Region region) throws EvictionException
 19    {
 20  14 return new ElementSizeQueue();
 21    }
 22   
 23  7103 protected boolean shouldEvictNode(NodeEntry ne)
 24    {
 25  7103 ElementSizeConfiguration config = (ElementSizeConfiguration) region.getEvictionPolicyConfig();
 26   
 27  7103 int size = this.getEvictionQueue().getNumberOfNodes();
 28  7103 if (config.getMaxNodes() != 0 && size > config.getMaxNodes())
 29    {
 30  7087 return true;
 31    }
 32   
 33  16 return ne.getNumberOfElements() > config.getMaxElementsPerNode();
 34    }
 35   
 36   
 37  31 protected void prune() throws EvictionException
 38    {
 39  31 super.prune();
 40   
 41    // clean up the Queue's eviction removals
 42  31 ((ElementSizeQueue) this.evictionQueue).prune();
 43    }
 44   
 45    }