001    /*
002    Copyright (C) 2000 Chr. Clemens Lee <clemens@kclee.com>.
003    
004    This file is part of JavaNCSS
005    (http://www.kclee.com/clemens/java/javancss/).
006    
007    JavaNCSS is free software; you can redistribute it and/or modify it
008    under the terms of the GNU General Public License as published by the
009    Free Software Foundation; either version 2, or (at your option) any
010    later version.
011    
012    JavaNCSS is distributed in the hope that it will be useful, but WITHOUT
013    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
014    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
015    for more details.
016    
017    You should have received a copy of the GNU General Public License
018    along with JavaNCSS; see the file COPYING.  If not, write to
019    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
020    Boston, MA 02111-1307, USA.  */
021    
022    package javancss;
023    
024    /**
025     * Base data class to store all metrics common to packages, objects and functions.
026     *
027     * @author  Herv? Boutemy
028     * @version $Id: Metric.java 121 2009-01-17 22:19:45Z hboutemy $
029     */
030    public abstract class Metric implements Comparable
031    {
032        public String name = ".";
033        /** Non Commenting Source Statements (NCSS). */
034        public int ncss = 0;
035        public int javadocs = 0;
036        public int javadocsLn = 0;
037        public int singleLn = 0;
038        public int multiLn = 0;
039    
040        public Metric()
041        {
042            super();
043        }
044    
045        public void clear()
046        {
047            name = ".";
048            ncss = 0;
049            javadocs = 0;
050            javadocsLn = 0;
051            singleLn = 0;
052            multiLn = 0;
053        }
054    
055        public String toString() {
056            return name;
057        }
058    
059        public int compareTo( Object o )
060        {
061            return name.compareTo( ((Metric)o).name );
062        }
063    
064        public boolean equals( Object o )
065        {
066            return compareTo( o ) == 0;
067        }
068    
069        public int hashCode()
070        {
071            return name.hashCode();
072        }
073    }