View Javadoc

1   /*
2   Copyright (C) 2000 Chr. Clemens Lee <clemens@kclee.com>.
3   
4   This file is part of JavaNCSS
5   (http://www.kclee.com/clemens/java/javancss/).
6   
7   JavaNCSS is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2, or (at your option) any
10  later version.
11  
12  JavaNCSS is distributed in the hope that it will be useful, but WITHOUT
13  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15  for more details.
16  
17  You should have received a copy of the GNU General Public License
18  along with JavaNCSS; see the file COPYING.  If not, write to
19  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  Boston, MA 02111-1307, USA.  */
21  
22  package javancss;
23  
24  /**
25   * Base data class to store all metrics common to packages, objects and functions.
26   *
27   * @author  Hervé Boutemy
28   * @version $Id: Metric.java 121 2009-01-17 22:19:45Z hboutemy $
29   */
30  public abstract class Metric implements Comparable
31  {
32      public String name = ".";
33      /** Non Commenting Source Statements (NCSS). */
34      public int ncss = 0;
35      public int javadocs = 0;
36      public int javadocsLn = 0;
37      public int singleLn = 0;
38      public int multiLn = 0;
39  
40      public Metric()
41      {
42          super();
43      }
44  
45      public void clear()
46      {
47          name = ".";
48          ncss = 0;
49          javadocs = 0;
50          javadocsLn = 0;
51          singleLn = 0;
52          multiLn = 0;
53      }
54  
55      public String toString() {
56          return name;
57      }
58  
59      public int compareTo( Object o )
60      {
61          return name.compareTo( ((Metric)o).name );
62      }
63  
64      public boolean equals( Object o )
65      {
66          return compareTo( o ) == 0;
67      }
68  
69      public int hashCode()
70      {
71          return name.hashCode();
72      }
73  }