Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 73   Methods: 4
NCLOC: 31   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
VersionedNode.java 50% 87.5% 100% 85.7%
coverage coverage
 1    /*
 2    * JBoss, Home of Professional Open Source
 3    *
 4    * Distributable under LGPL license.
 5    * See terms of license at gnu.org.
 6    */
 7    package org.jboss.cache;
 8   
 9    import org.jboss.cache.optimistic.DataVersion;
 10    import org.jboss.cache.optimistic.DefaultDataVersion;
 11   
 12    import java.util.Map;
 13   
 14    /**
 15    * VersionedNode extends the {@link org.jboss.cache.UnversionedNode} by adding a {@link org.jboss.cache.optimistic.DataVersion} property.
 16    * <p/>
 17    * Unlike {@link org.jboss.cache.UnversionedNode}, this node supports {@link #getVersion} and {@link #setVersion(org.jboss.cache.optimistic.DataVersion)}
 18    * defined in {@link org.jboss.cache.NodeSPI}
 19    * <p/>
 20    * Typically used when the cache mode configured is {@link org.jboss.cache.config.Configuration.NodeLockingScheme#OPTIMISTIC}
 21    *
 22    * @author <a href="mailto:manik@jboss.org">Manik Surtani (manik@jboss.org)</a>
 23    * @since 2.0.0
 24    */
 25    public class VersionedNode<K, V> extends UnversionedNode<K, V>
 26    {
 27    private DataVersion version;
 28    /**
 29    * Although this object has a reference to the CacheImpl, the optimistic
 30    * node is actually disconnected from the CacheImpl itself.
 31    * The parent could be looked up from the TransactionWorkspace.
 32    */
 33    private NodeSPI<K, V> parent;
 34   
 35  1902 protected VersionedNode(Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data, CacheSPI<K, V> cache)
 36    {
 37  1902 super(fqn.getLastElement(), fqn, data, false, cache);
 38  0 if (parent == null && !fqn.isRoot()) throw new NullPointerException("parent");
 39  1902 this.parent = parent;
 40  1902 this.version = DefaultDataVersion.ZERO;
 41    }
 42   
 43    /**
 44    * Returns the version id of this node.
 45    *
 46    * @return the version
 47    */
 48  1054613 @Override
 49    public DataVersion getVersion()
 50    {
 51  1054613 return version;
 52    }
 53   
 54    /**
 55    * Returns the parent.
 56    */
 57  541 @Override
 58    public NodeSPI<K, V> getParent()
 59    {
 60  541 return parent;
 61    }
 62   
 63    /**
 64    * Sets the version id of this node.
 65    *
 66    * @param version
 67    */
 68  1226 @Override
 69    public void setVersion(DataVersion version)
 70    {
 71  1226 this.version = version;
 72    }
 73    }