Coverage Report - net.sf.statcvs.model.Module
 
Classes in this File Line Coverage Branch Coverage Complexity
Module
0%
0/23
0%
0/6
1.429
 
 1  
 /**
 2  
  * 
 3  
  */
 4  
 package net.sf.statcvs.model;
 5  
 
 6  
 import java.util.Iterator;
 7  
 import java.util.SortedSet;
 8  
 import java.util.TreeSet;
 9  
 
 10  
 /**
 11  
  * @author Benoit
 12  
  *
 13  
  */
 14  
 public class Module implements Comparable {
 15  0
     private final SortedSet files = new TreeSet();
 16  
     private final String name;
 17  0
     private int currentLoc = -1;
 18  
 
 19  
     public Module(final String name) {
 20  0
         super();
 21  0
         this.name = name;
 22  0
     }
 23  
 
 24  
     public void addFile(final VersionedFile vf) {
 25  0
         files.add(vf);
 26  0
     }
 27  
 
 28  
     public int getCurrentLinesOfCode() {
 29  0
         if (currentLoc < 0) {
 30  0
             final Iterator it = files.iterator();
 31  0
             currentLoc = 0;
 32  0
             while (it.hasNext()) {
 33  0
                 final VersionedFile vf = (VersionedFile) it.next();
 34  0
                 currentLoc += vf.getCurrentLinesOfCode();
 35  
             }
 36  
         }
 37  0
         return currentLoc;
 38  
     }
 39  
 
 40  
     /**
 41  
      * Returns all {@link Revision}s to files in
 42  
      * this directory, in order from oldest to most recent.
 43  
      * @return list of <tt>Revision</tt>s for this directory
 44  
      */
 45  
     public SortedSet getRevisions() {
 46  0
         final SortedSet result = new TreeSet();
 47  0
         final Iterator iterator = files.iterator();
 48  0
         while (iterator.hasNext()) {
 49  0
             final VersionedFile file = (VersionedFile) iterator.next();
 50  0
             result.addAll(file.getRevisions());
 51  
         }
 52  0
         return result;
 53  
     }
 54  
 
 55  
     public int compareTo(final Object mod) {
 56  0
         return name.compareTo(((Module) mod).name);
 57  
     }
 58  
 
 59  
     public String getName() {
 60  0
         return name;
 61  
     }
 62  
 
 63  
     public SortedSet getFiles() {
 64  0
         return files;
 65  
     }
 66  
 }