Coverage Report - net.sf.statcvs.reports.FilesLocComparator
 
Classes in this File Line Coverage Branch Coverage Complexity
FilesLocComparator
0%
0/8
0%
0/4
5
 
 1  
 /*
 2  
         StatCvs - CVS statistics generation 
 3  
         Copyright (C) 2002  Lukasz Pekacki <lukasz@pekacki.de>
 4  
         http://statcvs.sf.net/
 5  
     
 6  
         This library is free software; you can redistribute it and/or
 7  
         modify it under the terms of the GNU Lesser General Public
 8  
         License as published by the Free Software Foundation; either
 9  
         version 2.1 of the License, or (at your option) any later version.
 10  
 
 11  
         This library is distributed in the hope that it will be useful,
 12  
         but WITHOUT ANY WARRANTY; without even the implied warranty of
 13  
         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14  
         Lesser General Public License for more details.
 15  
 
 16  
         You should have received a copy of the GNU Lesser General Public
 17  
         License along with this library; if not, write to the Free Software
 18  
         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 19  
     
 20  
         $RCSfile: FilesLocComparator.java,v $
 21  
         $Date: 2008/04/02 11:22:15 $
 22  
 */
 23  
 package net.sf.statcvs.reports;
 24  
 
 25  
 import java.util.Comparator;
 26  
 
 27  
 import net.sf.statcvs.model.VersionedFile;
 28  
 
 29  
 /**
 30  
  * Compares two files according to their lines of code
 31  
  * 
 32  
  * @author Richard Cyganiak <rcyg@gmx.de>
 33  
  * @version $Id: FilesLocComparator.java,v 1.3 2008/04/02 11:22:15 benoitx Exp $
 34  
  */
 35  0
 public class FilesLocComparator implements Comparator {
 36  
 
 37  
     /**
 38  
      * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
 39  
      */
 40  
     public int compare(final Object o1, final Object o2) {
 41  0
         final VersionedFile file1 = (VersionedFile) o1;
 42  0
         final VersionedFile file2 = (VersionedFile) o2;
 43  0
         if (file1.getCurrentLinesOfCode() < file2.getCurrentLinesOfCode()) {
 44  0
             return 1;
 45  0
         } else if (file1.getCurrentLinesOfCode() == file2.getCurrentLinesOfCode()) {
 46  0
             return 0;
 47  
         } else {
 48  0
             return -1;
 49  
         }
 50  
     }
 51  
 }