Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 99   Methods: 9
NCLOC: 64   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
BuddyGroup.java - 94.4% 88.9% 92.6%
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.buddyreplication;
 8   
 9    import net.jcip.annotations.ThreadSafe;
 10    import org.jgroups.Address;
 11   
 12    import java.io.Serializable;
 13    import java.util.ArrayList;
 14    import java.util.Collection;
 15    import java.util.Collections;
 16    import java.util.Date;
 17    import java.util.List;
 18    import java.util.concurrent.CopyOnWriteArrayList;
 19   
 20    /**
 21    * Value object that represents a buddy group
 22    *
 23    * @author <a href="mailto:manik@jboss.org">Manik Surtani (manik@jboss.org)</a>
 24    */
 25    @ThreadSafe
 26    public class BuddyGroup implements Serializable
 27    {
 28    /**
 29    * Serial version.
 30    */
 31    private static final long serialVersionUID = 5391883716108410301L;
 32   
 33    private String groupName;
 34   
 35    private Address dataOwner;
 36   
 37    private Date lastModified = new Date();
 38   
 39    /**
 40    * List<Address> - a list of JGroups addresses
 41    */
 42    private List<Address> buddies = new CopyOnWriteArrayList<Address>();
 43   
 44  869 public String getGroupName()
 45    {
 46  869 return groupName;
 47    }
 48   
 49  164 protected void setGroupName(String groupName)
 50    {
 51  164 this.groupName = groupName;
 52  164 lastModified = new Date();
 53    }
 54   
 55  730 public Address getDataOwner()
 56    {
 57  730 return dataOwner;
 58    }
 59   
 60  164 protected void setDataOwner(Address dataOwner)
 61    {
 62  164 this.dataOwner = dataOwner;
 63  164 lastModified = new Date();
 64    }
 65   
 66  623 public List<Address> getBuddies()
 67    {
 68    // defensive copy and immutable.
 69  623 return Collections.unmodifiableList(new ArrayList<Address>(buddies));
 70    }
 71   
 72  224 protected void addBuddies(Collection<Address> buddies)
 73    {
 74  224 this.buddies.addAll(buddies);
 75  224 lastModified = new Date();
 76    }
 77   
 78  56 protected void removeBuddies(Collection<Address> buddies)
 79    {
 80  56 this.buddies.removeAll(buddies);
 81  56 lastModified = new Date();
 82    }
 83   
 84  0 public Date getLastModified()
 85    {
 86  0 return lastModified;
 87    }
 88   
 89  579 public String toString()
 90    {
 91  579 StringBuffer b = new StringBuffer("BuddyGroup: (");
 92  579 b.append("dataOwner: ").append(dataOwner).append(", ");
 93  579 b.append("groupName: ").append(groupName).append(", ");
 94  579 b.append("buddies: ").append(buddies).append(",");
 95  579 b.append("lastModified: ").append(lastModified).append(")");
 96  579 return b.toString();
 97    }
 98   
 99    }