View Javadoc
1 /*** 2 * Statistic.java 3 * 4 * Project: Dependency Tool 5 * 6 * WHEN WHO WHAT 7 * 06.06.2003 pko initial public release 8 * 25.03.2002 ctr creation 9 * 10 * Copyright 2003 ELCA Informatique SA 11 * Av. de la Harpe 22-24, 1000 Lausanne 13, Switzerland 12 * www.elca.ch 13 * 14 * This library is free software; you can redistribute it and/or 15 * modify it under the terms of the GNU Lesser General Public License 16 * as published by the Free Software Foundation; either version 2.1 of 17 * the License, or (at your option) any later version. 18 * 19 * This library is distributed in the hope that it will be useful, but 20 * WITHOUT ANY WARRANTY; without even the implied warranty of 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 * Lesser General Public License for more details. 23 * 24 * You should have received a copy of the GNU Lesser General Public 25 * License along with this library; if not, write to the Free Software 26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 27 * USA 28 */ 29 30 package ch.elca.dependency.core; 31 32 /*** 33 * Represents all the statistic data which comes fron the initial analyse.<br> 34 * This class acts just as struct with its access methods. 35 * 36 * @author Christoph Trutmann 37 * @version 1.0-beta 38 */ 39 public class Statistic implements Cloneable { 40 41 /*** 42 * Number of classes in the project. 43 */ 44 private int m_projClasses; 45 46 /*** 47 * Number of packages in the project. 48 */ 49 private int m_projPackages; 50 51 /*** 52 * Number of vertices in the project. 53 */ 54 private int m_projVertices; 55 56 /*** 57 * Number of analyzed classes. 58 */ 59 private int m_analyzedClasses; 60 61 /*** 62 * Number of analyzed packages. 63 */ 64 private int m_analyzedPackages; 65 66 /*** 67 * Number of vertices which passed the load filter. 68 */ 69 private int m_analyzedVertices; 70 71 /*** 72 * Number of "uses" dependencies. 73 */ 74 private int m_numberOfUsesDep; 75 76 /*** 77 * Biggest package in the project (max number of classes). 78 */ 79 private String m_biggestProjPackage; 80 81 /*** 82 * Biggest package which passed the load filter (max number of classes). 83 */ 84 private String m_biggestAnalyzedPackage; 85 86 87 /*** 88 * Constructor. 89 */ 90 public Statistic() { 91 } 92 93 94 /*** 95 * Sets the number of classes in the project. 96 * 97 * @param classTotal Number of classes in the project. 98 */ 99 public void setProjClasses(int classTotal){ 100 m_projClasses = classTotal; 101 } 102 103 104 /*** 105 * Gets the number of classes in the project. 106 * 107 * @return Number of classes in the project. 108 */ 109 public int getProjClasses(){ 110 return m_projClasses; 111 } 112 113 114 /*** 115 * Sets the number of packages in the project. 116 * 117 * @param packageTotal Number of packages in the project. 118 */ 119 public void setProjPackages(int packageTotal){ 120 m_projPackages = packageTotal; 121 } 122 123 124 /*** 125 * Gets the number of packages in the project. 126 * 127 * @return Number of packages in the project. 128 */ 129 public int getProjPackages(){ 130 return m_projPackages; 131 } 132 133 134 /*** 135 * Sets the number of vertices in the project. 136 * 137 * @param vertices Number of the vertices in the project. 138 */ 139 public void setProjVertices(int vertices){ 140 m_projVertices = vertices; 141 } 142 143 144 /*** 145 * Gets the number of library packages in the project. 146 * 147 * @return Number of the library packages in the project. 148 */ 149 public int getProjLibPackages(){ 150 return m_projVertices - m_projPackages; 151 } 152 153 154 /*** 155 * Sets number of classes. 156 * 157 * @param classes Number of classes in the analyzed project. 158 */ 159 public void setAnalyzedClasses(int classes){ 160 m_analyzedClasses = classes; 161 } 162 163 164 /*** 165 * Gets the number of clsses. 166 * 167 * @return Number of classes in the analyzed project. 168 */ 169 public int getAnalyzedClasses(){ 170 return m_analyzedClasses; 171 } 172 173 174 /*** 175 * Sets the number of packages. 176 * 177 * @param packages Number of packages in the analyzed project. 178 */ 179 public void setAnalyzedPackages(int packages){ 180 m_analyzedPackages = packages; 181 } 182 183 184 /*** 185 * Gets the number of packages. 186 * 187 * @return Number of packages in the analyzed project. 188 */ 189 public int getAnalyzedPackages(){ 190 return m_analyzedPackages; 191 } 192 193 194 /*** 195 * Sets the number of vertices which passed the load filter. 196 * 197 * @param vertices Number of the vertices which passed the load filter. 198 */ 199 public void setAnalyzedVertices(int vertices){ 200 m_analyzedVertices = vertices; 201 } 202 203 204 /*** 205 * Gets the number of library packages which passed the load filter. 206 * 207 * @return Number of the library packages which passed the load filter. 208 */ 209 public int getAnalyzedLibPackages(){ 210 return m_analyzedVertices - m_analyzedPackages; 211 } 212 213 214 /*** 215 * Sets the number of "uses" dependencies in the view. 216 * 217 * @param dep Number of dependencies in the analyzed project. 218 */ 219 public void setNumberOfUsesDep(int dep){ 220 m_numberOfUsesDep = dep; 221 } 222 223 224 /*** 225 * Gets the number of "uses" dependencies. 226 * 227 * @return Number of dependencies in the analyzed project. 228 */ 229 public int getNumberOfUsesDep(){ 230 return m_numberOfUsesDep; 231 } 232 233 234 /*** 235 * Sets the biggest package in the analyzed project. 236 * 237 * @param bigPackage Biggest package in the analyzed project. 238 */ 239 public void setBiggestProjPackage(String bigPackage){ 240 m_biggestProjPackage = bigPackage; 241 } 242 243 244 /*** 245 * Gets the biggest package in the project; 246 * 247 * @return Biggest package in the project. 248 */ 249 public String getBiggestProjPackage(){ 250 return m_biggestProjPackage; 251 } 252 253 254 /*** 255 * Sets the biggest package which passed the load filter. 256 * 257 * @param bigPackage Biggest package which passed the load filter. 258 */ 259 public void setBiggestAnalyzedPackage(String bigPackage){ 260 m_biggestAnalyzedPackage = bigPackage; 261 } 262 263 264 /*** 265 * Gets the biggest package which passed the load filter. 266 * 267 * @return Biggest package which passed the load filter. 268 */ 269 public String getBiggestAnalyzedPackage(){ 270 return m_biggestAnalyzedPackage; 271 } 272 273 274 /*** 275 * Gets the average classes per package in the whole project. 276 * 277 * @return Average number of classes per package in the project. 278 */ 279 public double getAverageProjClassesPerPackage(){ 280 return Math.rint((double)m_projClasses/m_projPackages*1000)/1000; 281 } 282 283 284 /*** 285 * Gets the average classes per package which passed the load filter. 286 * 287 * @return Average number of classes per package which passed the load 288 * filter. 289 */ 290 public double getAverageAnalyzedClassesPerPackage(){ 291 return 292 Math.rint((double)m_analyzedClasses/m_analyzedPackages*1000)/1000; 293 } 294 295 296 /*** 297 * Creates and returns a copy of this object. 298 * 299 * @return A clone of this instance. 300 * @throws CloneNotSupportedException If the object's class does not support 301 * the Cloneable interface. Subclasses 302 * that override the clone method can 303 * also throw this exception to indicate 304 * that an instance cannot be cloned. 305 */ 306 public Object clone() throws CloneNotSupportedException { 307 return super.clone(); 308 } 309 }

This page was automatically generated by Maven