001    /*
002     * Cobertura - http://cobertura.sourceforge.net/
003     *
004     * This file was taken from JavaNCSS
005     * http://www.kclee.com/clemens/java/javancss/
006     * Copyright (C) 2000 Chr. Clemens Lee <clemens a.t kclee d.o.t com>
007     *
008     * Cobertura is free software; you can redistribute it and/or modify
009     * it under the terms of the GNU General Public License as published
010     * by the Free Software Foundation; either version 2 of the License,
011     * or (at your option) any later version.
012     *
013     * Cobertura is distributed in the hope that it will be useful, but
014     * WITHOUT ANY WARRANTY; without even the implied warranty of
015     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016     * General Public License for more details.
017     *
018     * You should have received a copy of the GNU General Public License
019     * along with Cobertura; if not, write to the Free Software
020     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
021     * USA
022     */
023    
024    
025    /*
026     *
027     * WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING  
028     *
029     * WARNING TO COBERTURA DEVELOPERS
030     *
031     * DO NOT MODIFY THIS FILE!
032     *
033     * MODIFY THE FILES UNDER THE JAVANCSS DIRECTORY LOCATED AT THE ROOT OF THE COBERTURA PROJECT.
034     *
035     * FOLLOW THE PROCEDURE FOR MERGING THE LATEST JAVANCSS INTO COBERTURA LOCATED AT
036     * javancss/coberturaREADME.txt
037     *
038     * WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   
039     */
040    /*
041    Copyright (C) 2000 Chr. Clemens Lee <clemens@kclee.com>.
042    
043    This file is part of JavaNCSS
044    (http://www.kclee.com/clemens/java/javancss/).
045    
046    JavaNCSS is free software; you can redistribute it and/or modify it
047    under the terms of the GNU General Public License as published by the
048    Free Software Foundation; either version 2, or (at your option) any
049    later version.
050    
051    JavaNCSS is distributed in the hope that it will be useful, but WITHOUT
052    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
053    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
054    for more details.
055    
056    You should have received a copy of the GNU General Public License
057    along with JavaNCSS; see the file COPYING.  If not, write to
058    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
059    Boston, MA 02111-1307, USA.  */
060    
061    package net.sourceforge.cobertura.javancss;
062    
063    /**
064     * Base data class to store all metrics common to packages, objects and functions.
065     *
066     * @author  Herv? Boutemy
067     * @version $Id: Metric.java 121 2009-01-17 22:19:45Z hboutemy $
068     */
069    public abstract class Metric implements Comparable
070    {
071        public String name = ".";
072        /** Non Commenting Source Statements (NCSS). */
073        public int ncss = 0;
074        public int javadocs = 0;
075        public int javadocsLn = 0;
076        public int singleLn = 0;
077        public int multiLn = 0;
078    
079        public Metric()
080        {
081            super();
082        }
083    
084        public void clear()
085        {
086            name = ".";
087            ncss = 0;
088            javadocs = 0;
089            javadocsLn = 0;
090            singleLn = 0;
091            multiLn = 0;
092        }
093    
094        public String toString() {
095            return name;
096        }
097    
098        public int compareTo( Object o )
099        {
100            return name.compareTo( ((Metric)o).name );
101        }
102    
103        public boolean equals( Object o )
104        {
105            return compareTo( o ) == 0;
106        }
107    
108        public int hashCode()
109        {
110            return name.hashCode();
111        }
112    }