Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 168   Methods: 19
NCLOC: 118   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
NodeEntry.java 62.5% 89.7% 94.7% 87.9%
coverage coverage
 1    package org.jboss.cache.eviction;
 2   
 3    import org.jboss.cache.Fqn;
 4   
 5    /**
 6    * Value object used in queue
 7    *
 8    * @author Ben Wang 2-2004
 9    * @author Daniel Huang - dhuang@jboss.org
 10    */
 11    public class NodeEntry
 12    {
 13    private long modifiedTimeStamp;
 14    private long creationTimeStamp;
 15    private int numberOfNodeVisits;
 16    private int numberOfElements;
 17    private Fqn fqn;
 18   
 19    private long inUseTimeoutTimestamp;
 20    private boolean currentlyInUse = false;
 21   
 22    EvictionQueue queue;
 23   
 24    /**
 25    * Private constructor that automatically sets the creation time stamp of the node entry.
 26    */
 27  930331 private NodeEntry()
 28    {
 29  930331 this.creationTimeStamp = System.currentTimeMillis();
 30    }
 31   
 32  216864 public NodeEntry(Fqn fqn)
 33    {
 34  216864 this();
 35  216864 setFqn(fqn);
 36    }
 37   
 38  713467 public NodeEntry(String fqn)
 39    {
 40  713467 this();
 41  713467 setFqn(Fqn.fromString(fqn));
 42    }
 43   
 44    /**
 45    * Is the node currently in use.
 46    *
 47    * @return True/false if the node is currently marked as in use.
 48    */
 49  48807 public boolean isCurrentlyInUse()
 50    {
 51  48807 return currentlyInUse;
 52    }
 53   
 54  1 public void setCurrentlyInUse(boolean currentlyInUse, long inUseTimeout)
 55    {
 56  1 this.currentlyInUse = currentlyInUse;
 57  1 if (inUseTimeout > 0)
 58    {
 59  0 this.inUseTimeoutTimestamp = System.currentTimeMillis() + inUseTimeout;
 60    }
 61    }
 62   
 63  3 public long getInUseTimeoutTimestamp()
 64    {
 65  3 return this.inUseTimeoutTimestamp;
 66    }
 67   
 68    /**
 69    * Get modified time stamp. This stamp is created during the node is
 70    * processed so it has some fuzy tolerance in there.
 71    *
 72    * @return The last modified time stamp
 73    */
 74  46469 public long getModifiedTimeStamp()
 75    {
 76  46469 return modifiedTimeStamp;
 77    }
 78   
 79  973626 public void setModifiedTimeStamp(long modifiedTimeStamp)
 80    {
 81  973626 this.modifiedTimeStamp = modifiedTimeStamp;
 82    }
 83   
 84    /**
 85    * Get the time stamp for when the node entry was created.
 86    *
 87    * @return The node entry creation time stamp
 88    */
 89  1251 public long getCreationTimeStamp()
 90    {
 91  1251 return creationTimeStamp;
 92    }
 93   
 94  0 public void setCreationTimeStamp(long creationTimeStamp)
 95    {
 96  0 this.creationTimeStamp = creationTimeStamp;
 97    }
 98   
 99  1194669 public int getNumberOfNodeVisits()
 100    {
 101  1194669 return numberOfNodeVisits;
 102    }
 103   
 104  974100 public void setNumberOfNodeVisits(int numberOfNodeVisits)
 105    {
 106  974100 this.numberOfNodeVisits = numberOfNodeVisits;
 107    }
 108   
 109  1479339 public int getNumberOfElements()
 110    {
 111  1479339 return numberOfElements;
 112    }
 113   
 114  337851 public void setNumberOfElements(int numberOfElements)
 115    {
 116  337851 if (queue != null)
 117    {
 118  120932 int difference = numberOfElements - this.numberOfElements;
 119  120932 queue.modifyElementCount(difference);
 120    }
 121  337851 this.numberOfElements = numberOfElements;
 122    }
 123   
 124  15146437 public Fqn getFqn()
 125    {
 126  15146437 return fqn;
 127    }
 128   
 129  930331 void setFqn(Fqn fqn)
 130    {
 131  930331 this.fqn = fqn;
 132    }
 133   
 134  116475 public int hashCode()
 135    {
 136  116475 return fqn.hashCode();
 137    }
 138   
 139  12743478 public boolean equals(Object o)
 140    {
 141  12743478 if (!(o instanceof NodeEntry))
 142  0 return false;
 143  12743478 NodeEntry ne = (NodeEntry) o;
 144  12743478 return fqn.equals(ne.getFqn());
 145    }
 146   
 147  17 public String toString()
 148    {
 149  17 StringBuffer output = new StringBuffer();
 150  17 output.append("Fqn: ");
 151  17 if (fqn != null)
 152    {
 153  17 output.append(fqn);
 154    }
 155    else
 156    {
 157  0 output.append(" null");
 158    }
 159   
 160  17 output.append(" CreateTime: ").append(this.getCreationTimeStamp());
 161  17 output.append(" NodeVisits: ").append(this.getNumberOfNodeVisits());
 162  17 output.append(" ModifiedTime: ").append(this.getModifiedTimeStamp());
 163  17 output.append(" NumberOfElements: ").append(this.getNumberOfElements());
 164  17 output.append(" CurrentlyInUse: ").append(this.isCurrentlyInUse());
 165  17 return output.toString();
 166    }
 167   
 168    }