QuickPackageResults.java


Package: org.hammurapi

Results
Date2007/07/27
Codebase5577
Reviews10166
DPMO1974
Sigma4.382

Metrics
NameNumberMinAvgMaxTotal
Class complexity1117.00117.00117.00117.00
Code length820.005.47128.00449.00
File length1523.00523.00523.00523.00
Operation complexity811.002.2835.00185.00

Violations
#LineColumnNameSeverityDescription
1231ER-0233Packages should begin with []
263116ER-0363Line is too long
374112ER-0363Line is too long
479115ER-0363Line is too long
58090ER-0363Line is too long
69583ER-0363Line is too long
79690ER-0363Line is too long
899111ER-0363Line is too long
910090ER-0363Line is too long
1010790ER-0363Line is too long
1110890ER-0363Line is too long
1211184ER-0363Line is too long
1311290ER-0363Line is too long
1411580ER-0363Line is too long
1511690ER-0363Line is too long
1611990ER-0363Line is too long
1712090ER-0363Line is too long
1813188ER-0363Line is too long
19136107ER-0363Line is too long
2014991ER-0363Line is too long
21151215ER-0363Line is too long
22164108ER-0363Line is too long
2316883ER-0363Line is too long
2417081ER-0363Line is too long
25172245ER-0363Line is too long
2617782ER-0363Line is too long
2718184ER-0363Line is too long
2818480ER-0363Line is too long
2918590ER-0363Line is too long
3018998ER-0363Line is too long
3122483ER-0363Line is too long
32234120ER-0363Line is too long
33236143ER-0363Line is too long
3423781ER-0363Line is too long
3524688ER-0363Line is too long
3624791ER-0363Line is too long
3725084ER-0363Line is too long
3825488ER-0363Line is too long
3925596ER-0363Line is too long
4025881ER-0363Line is too long
4125984ER-0363Line is too long
4226284ER-0363Line is too long
4326685ER-0363Line is too long
44267101ER-0363Line is too long
4527087ER-0363Line is too long
4627190ER-0363Line is too long
4727496ER-0363Line is too long
4827888ER-0363Line is too long
49279100ER-0363Line is too long
50280136ER-0363Line is too long
51281101ER-0363Line is too long
52282113ER-0363Line is too long
53284108ER-0363Line is too long
54298113ER-0363Line is too long
5530784ER-0363Line is too long
56308106ER-0363Line is too long
5731180ER-0363Line is too long
58314133ER-0363Line is too long
5931592ER-0363Line is too long
60316100ER-0363Line is too long
61317101ER-0363Line is too long
6231892ER-0363Line is too long
63321112ER-0363Line is too long
6433284ER-0363Line is too long
6533382ER-0363Line is too long
66334118ER-0363Line is too long
67335113ER-0363Line is too long
68337130ER-0363Line is too long
69338125ER-0363Line is too long
7033986ER-0363Line is too long
71340105ER-0363Line is too long
72341116ER-0363Line is too long
7334280ER-0363Line is too long
74343107ER-0363Line is too long
7534498ER-0363Line is too long
7634588ER-0363Line is too long
77346142ER-0363Line is too long
7834781ER-0363Line is too long
7935094ER-0363Line is too long
8035382ER-0363Line is too long
81383111ER-0363Line is too long
8238585ER-0363Line is too long
8338886ER-0363Line is too long
8439080ER-0363Line is too long
85391102ER-0363Line is too long
8639480ER-0363Line is too long
8739592ER-0363Line is too long
8839880ER-0363Line is too long
8939992ER-0363Line is too long
9040280ER-0363Line is too long
91403120ER-0363Line is too long
9240682ER-0363Line is too long
9340795ER-0363Line is too long
9441098ER-0363Line is too long
95411106ER-0363Line is too long
96414112ER-0363Line is too long
97415106ER-0363Line is too long
9841893ER-0363Line is too long
9942281ER-0363Line is too long
10042388ER-0363Line is too long
101481180ER-0363Line is too long
102494212ER-0363Line is too long
103531ER-0111Cyclomatic complexity (117) exceeds 100
104531ER-0492Unify logging strategy - define individual logger for class
105639ER-1093It is good practice to call in any case super() in a constructor. (see also: UnnecessaryConstructorRule )
106719ER-0111Cyclomatic complexity (35) exceeds 12
107719ER-0412Method is too long
108719ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
1097941ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
1108341ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
1118741ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
1129141ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
1139541ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
1149941ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
1159997ER-0481Use BigDecimal instead of Float or Double for monetary values
11610341ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
11710741ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
11811141ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
11911541ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
12011941ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
12112341ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
12212741ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
12313141ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
12413541ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
12513941ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
12614341ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
12714741ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
12814964ER-0303Avoid hardwired string literals
12915179ER-0792Avoid casting primitive data types to lower precision
13015186ER-0293Avoid hardwired numeric literals
131151172ER-0303Avoid hardwired string literals
132151212ER-0303Avoid hardwired string literals
13315541ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
13415941ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
13516341ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
13616449ER-0481Use BigDecimal instead of Float or Double for monetary values
13716664ER-0303Avoid hardwired string literals
13816864ER-0303Avoid hardwired string literals
13917064ER-0303Avoid hardwired string literals
14017285ER-0303Avoid hardwired string literals
141172166ER-0293Avoid hardwired numeric literals
142172202ER-0303Avoid hardwired string literals
143172242ER-0303Avoid hardwired string literals
14417641ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
14517648ER-0481Use BigDecimal instead of Float or Double for monetary values
14618041ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
14718156ER-0792Avoid casting primitive data types to lower precision
14818441ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
14918556ER-0792Avoid casting primitive data types to lower precision
15018841ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
15119241ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
1522029ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
1532069ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
1542129ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
1552169ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
1562209ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
1572249ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
1582309ER-0111Cyclomatic complexity (15) exceeds 12
1592309ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
16024657ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
16125057ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
16225457ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
16325572ER-0792Avoid casting primitive data types to lower precision
16425857ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
16526257ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
16626372ER-0303Avoid hardwired string literals
16726657ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
16827057ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
16927457ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
17027857ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
1712959ER-0111Cyclomatic complexity (20) exceeds 12
1722959ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
17330341ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
17430741ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
17532541ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
17632941ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
1773669ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
1783709ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
1793749ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
18037465ER-0481Use BigDecimal instead of Float or Double for monetary values
1813809ER-0111Cyclomatic complexity (13) exceeds 12
1823809ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
18339057ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
18439172ER-0792Avoid casting primitive data types to lower precision
18539457ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
18639464ER-0481Use BigDecimal instead of Float or Double for monetary values
18739857ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
18839864ER-0481Use BigDecimal instead of Float or Double for monetary values
18940257ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
19040264ER-0481Use BigDecimal instead of Float or Double for monetary values
19140657ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
19240664ER-0481Use BigDecimal instead of Float or Double for monetary values
19341057ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
19441073ER-0481Use BigDecimal instead of Float or Double for monetary values
19541496ER-0823Avoid using method parameter names that conflict with class member names
19641457ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
19741857ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
19842257ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
19942629ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
20042636ER-0481Use BigDecimal instead of Float or Double for monetary values
2014379ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
2024419ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
2034459ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
2044499ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
2054539ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
2064579ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
2074619ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
2084659ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
2094699ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
2104739ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
2114779ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
21247932ER-0303Avoid hardwired string literals
21348147ER-0792Avoid casting primitive data types to lower precision
21448154ER-0293Avoid hardwired numeric literals
215481137ER-0303Avoid hardwired string literals
216481177ER-0303Avoid hardwired string literals
2174859ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
21848617ER-0481Use BigDecimal instead of Float or Double for monetary values
21948832ER-0303Avoid hardwired string literals
22049032ER-0303Avoid hardwired string literals
22149232ER-0303Avoid hardwired string literals
22249453ER-0303Avoid hardwired string literals
223494134ER-0293Avoid hardwired numeric literals
224494169ER-0303Avoid hardwired string literals
225494209ER-0303Avoid hardwired string literals
2264989ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
2275029ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
2285069ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
22950616ER-0481Use BigDecimal instead of Float or Double for monetary values
2305109ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
23151124ER-0792Avoid casting primitive data types to lower precision
2325149ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc
23351524ER-0792Avoid casting primitive data types to lower precision
2345189ER-1053Document all Interfaces and public methods. Use a Class header. Provide Javadoc

JavaDoc
QuickPackageResults

1/*
2 * Hammurapi
3 * Automated Java code review system.
4 * Copyright (C) 2004 Hammurapi Group
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program 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
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * URL: http://www.hammurapi.org
21 * e-Mail: support@hammurapi.biz
22 */

23package org.hammurapi;
24
25import java.text.MessageFormat;
26import java.util.ArrayList;
27import java.util.Collection;
28import java.util.Date;
29import java.util.Iterator;
30import java.util.List;
31import java.util.Map;
32import java.util.TreeMap;
33
34import org.hammurapi.results.AggregatedResults;
35import org.hammurapi.results.Annotation;
36import org.hammurapi.results.BasicResults;
37import org.hammurapi.results.CompositeResults;
38import org.hammurapi.results.InspectorSummary;
39import org.hammurapi.results.NamedResults;
40import org.hammurapi.results.quick.MetricSummary;
41import org.hammurapi.results.quick.PackageTotal;
42import org.hammurapi.results.quick.Result;
43import org.hammurapi.results.quick.Warning;
44import org.hammurapi.results.simple.SimpleAggregatedResults;
45
46import com.pavelvlasov.review.SimpleSourceMarker;
47import com.pavelvlasov.review.SourceMarker;
48
49/**
50 * @author Pavel Vlasov
51 * @version $Revision: 1.5 $
52 */

53public class QuickPackageResults implements CompositeResults {
54
55 private PackageTotal total;
56 private QuickResultsCollector collector;
57 private InspectorSet inspectorSet;
58
59 /**
60 * @param total
61 * @param collector
62 */

63 public QuickPackageResults(PackageTotal total, QuickResultsCollector collector, InspectorSet inspectorSet) {
64 this.total=total;
65 this.collector=collector;
66 this.inspectorSet=inspectorSet;
67 }
68
69 private List children;
70
71 public Collection getChildren() {
72 if (children==null) {
73 children=new ArrayList();
74 Iterator rit=collector.getEngine().getPackageResults(total.getPackageName()).iterator();
75 while (rit.hasNext()) {
76 final Result result=(Result) rit.next();
77 children.add(new NamedResults() {
78
79 public Waiver addViolation(Violation violation) throws HammurapiException {
80 throw new UnsupportedOperationException();
81 }
82
83 public Map getSeveritySummary() {
84 return null;
85 }
86
87 public Collection getWarnings() {
88 return null;
89 }
90
91 public boolean hasWarnings() {
92 return result.getHasWarnings();
93 }
94
95 public void addWarning(Violation warning) {
96 throw new UnsupportedOperationException();
97 }
98
99 public void addMetric(SourceMarker source, String name, double value) {
100 throw new UnsupportedOperationException();
101 }
102
103 public Map getMetrics() {
104 return null;
105 }
106
107 public void aggregate(AggregatedResults agregee) {
108 throw new UnsupportedOperationException();
109 }
110
111 public void setReviewsNumber(long reviews) {
112 throw new UnsupportedOperationException();
113 }
114
115 public void setCodeBase(long codeBase) {
116 throw new UnsupportedOperationException();
117 }
118
119 public void addAnnotation(Annotation annotation) {
120 throw new UnsupportedOperationException();
121 }
122
123 public Collection getAnnotations() {
124 return null;
125 }
126
127 public WaiverSet getWaiverSet() {
128 return null;
129 }
130
131 public void commit() throws HammurapiException {
132
133 }
134
135 public boolean isNew() {
136 return result.getState()==QuickResultsCollector.RESULT_NEW;
137 }
138
139 public BasicResults getBaseLine() {
140 return null;
141 }
142
143 public long getCodeBase() {
144 return result.getCodebase();
145 }
146
147 public String getDPMO() {
148 if (result.getReviews()==0) {
149 return "Not available, no reviews";
150 } else {
151 return String.valueOf((int) (1000000*result.getViolationLevel()/result.getReviews())) + (result.getHasWarnings() ? " (not accurate because of warnings)" : "");
152 }
153 }
154
155 public Number getMaxSeverity() {
156 return result.getMaxSeverity();
157 }
158
159 public long getReviewsNumber() {
160 return result.getReviews();
161 }
162
163 public String getSigma() {
164 double p=1.0-result.getViolationLevel()/result.getReviews();
165 if (result.getReviews()==0) {
166 return "No results";
167 } else if (p<=0) {
168 return "Full incompliance";
169 } else if (p>=1) {
170 return "Full compliance";
171 } else {
172 return MessageFormat.format("{0,number,#.###}", new Object[] {new Double(SimpleAggregatedResults.normsinv(p)+1.5)}) + (result.getHasWarnings() ? " (not accurate because of warnings)" : "");
173 }
174 }
175
176 public double getViolationLevel() {
177 return result.getViolationLevel();
178 }
179
180 public int getViolationsNumber() {
181 return (int) result.getViolations();
182 }
183
184 public int getWaivedViolationsNumber() {
185 return (int) result.getWaivedViolations();
186 }
187
188 public Date getDate() {
189 return new Date(result.getResultDate().getTime());
190 }
191
192 public String getName() {
193 return result.getName();
194 }
195
196 });
197 }
198 }
199 return children;
200 }
201
202 public void add(AggregatedResults child) {
203 throw new UnsupportedOperationException();
204 }
205
206 public int size() {
207 return total.getResultSize();
208 }
209
210 private Collection violations=new ArrayList();
211
212 public Collection getViolations() {
213 return violations;
214 }
215
216 public Collection getWaivedViolations() {
217 return violations;
218 }
219
220 public String getName() {
221 return total.getPackageName();
222 }
223
224 public Waiver addViolation(Violation violation) throws HammurapiException {
225 throw new UnsupportedOperationException();
226 }
227
228 private Map severitySummary;
229
230 public Map getSeveritySummary() {
231 if (severitySummary==null) {
232 severitySummary=new TreeMap();
233
234 Iterator it=collector.getEngine().getPackageInspectorSummary(total.getPackageName()).iterator();
235 while (it.hasNext()) {
236 final org.hammurapi.results.quick.InspectorSummary ps=(org.hammurapi.results.quick.InspectorSummary) it.next();
237 Integer severity = new Integer(ps.getSeverity());
238 Map imap=(Map) severitySummary.get(severity);
239 if (imap==null) {
240 imap=new TreeMap();
241 severitySummary.put(severity, imap);
242 }
243 imap.put(ps.getName(),
244 new InspectorSummary() {
245
246 public String getDescription() {
247 return ps.getDescription();
248 }
249
250 public List getLocations() {
251 return null;
252 }
253
254 public int getLocationsCount() {
255 return (int) ps.getViolations();
256 }
257
258 public String getName() {
259 return ps.getName();
260 }
261
262 public String getVersion() {
263 return "";
264 }
265
266 public Number getSeverity() {
267 return new Integer(ps.getSeverity());
268 }
269
270 public String getConfigInfo() {
271 return ps.getConfigInfo();
272 }
273
274 public int getBaseLineLocationsCount() {
275 return -1;
276 }
277
278 public int compareTo(Object o) {
279 if (o instanceof InspectorSummary) {
280 return ps.getName().compareTo(((InspectorSummary) o).getName());
281 } else if (o instanceof Comparable) {
282 return -((Comparable) o).compareTo(this);
283 } else {
284 return this.hashCode()-o.hashCode();
285 }
286 }
287 });
288 }
289 }
290 return severitySummary;
291 }
292
293 private Collection warnings;
294
295 public Collection getWarnings() {
296 if (warnings==null) {
297 warnings=new ArrayList();
298 Iterator it=collector.getEngine().getWarningPackageEQ(total.getPackageName()).iterator();
299 while (it.hasNext()) {
300 final Warning warning=(Warning) it.next();
301 warnings.add(new Violation() {
302
303 public String getMessage() {
304 return warning.getMessage();
305 }
306
307 public InspectorDescriptor getDescriptor() {
308 return inspectorSet.getDescriptor(warning.getInspector());
309 }
310
311 private SimpleSourceMarker sourceMarker;
312
313 {
314 if (warning.getSource()!=null && warning.getLine()!=null && warning.getCol()!=null) {
315 sourceMarker=new SimpleSourceMarker(
316 warning.getCol().intValue(),
317 warning.getLine().intValue(),
318 warning.getSource(),
319 null);
320
321 sourceMarker.setSignature(warning.getSourceSignature());
322 }
323 }
324
325 public SourceMarker getSource() {
326 return sourceMarker;
327 }
328
329 public int compareTo(Object o) {
330 if (o==this) {
331 return 0;
332 } else if (o instanceof Violation) {
333 Violation v=(Violation) o;
334 int vline = v.getSource()==null ? 0 : v.getSource().getLine();
335 int line = getSource()==null ? 0 : getSource().getLine();
336 if (vline==line) {
337 int vcolumn = v.getSource()==null ? 0 : v.getSource().getColumn();
338 int column = getSource()==null ? 0 : getSource().getColumn();
339 if (vcolumn==column) {
340 if (warning.getMessage()==null) {
341 return v.getMessage()==null ? 0 : 1;
342 } else {
343 if (v.getMessage()==null) {
344 return -1;
345 } else {
346 return warning.getMessage().compareTo(v.getMessage());
347 }
348 }
349 } else {
350 return column-vcolumn;
351 }
352 } else {
353 return line-vline;
354 }
355 } else {
356 return 1;
357 }
358 }
359
360 });
361 }
362 }
363 return warnings;
364 }
365
366 public boolean hasWarnings() {
367 return total.getHasWarnings();
368 }
369
370 public void addWarning(Violation warning) {
371 throw new UnsupportedOperationException();
372 }
373
374 public void addMetric(SourceMarker source, String name, double value) {
375 throw new UnsupportedOperationException();
376 }
377
378 private Map metrics;
379
380 public Map getMetrics() {
381 if (metrics==null) {
382 metrics=new TreeMap();
383 Iterator it=collector.getEngine().getPackageMetrics(total.getPackageName()).iterator();
384 while (it.hasNext()) {
385 final MetricSummary metric=(MetricSummary) it.next();
386 metrics.put(
387 metric.getName(),
388 new com.pavelvlasov.metrics.Metric() {
389
390 public int getNumber() {
391 return (int) metric.getMeasurements();
392 }
393
394 public double getMin() {
395 return metric.getMinValue();
396 }
397
398 public double getMax() {
399 return metric.getMaxValue();
400 }
401
402 public double getAvg() {
403 return metric.getMetricTotal()/metric.getMeasurements();
404 }
405
406 public double getTotal() {
407 return metric.getMetricTotal();
408 }
409
410 public void add(double value, long time) {
411 throw new UnsupportedOperationException();
412 }
413
414 public void add(com.pavelvlasov.metrics.Metric metric) {
415 throw new UnsupportedOperationException();
416 }
417
418 public Collection getMeasurements() {
419 return null;
420 }
421
422 public String getName() {
423 return metric.getName();
424 }
425
426 public double getDeviation() {
427 // TODO - Calcualte deviation
428
return 0;
429 }
430
431 });
432 }
433 }
434 return metrics;
435 }
436
437 public void aggregate(AggregatedResults agregee) {
438 throw new UnsupportedOperationException();
439 }
440
441 public void setReviewsNumber(long reviews) {
442 throw new UnsupportedOperationException();
443 }
444
445 public void setCodeBase(long codeBase) {
446 throw new UnsupportedOperationException();
447 }
448
449 public void addAnnotation(Annotation annotation) {
450 throw new UnsupportedOperationException();
451 }
452
453 public Collection getAnnotations() {
454 return violations;
455 }
456
457 public WaiverSet getWaiverSet() {
458 throw new UnsupportedOperationException();
459 }
460
461 public void commit() throws HammurapiException {
462
463 }
464
465 public boolean isNew() {
466 return total.getMinState()==QuickResultsCollector.RESULT_NEW;
467 }
468
469 public BasicResults getBaseLine() {
470 return null;
471 }
472
473 public long getCodeBase() {
474 return total.getCodebase();
475 }
476
477 public String getDPMO() {
478 if (total.getReviews()==0) {
479 return "Not available, no reviews";
480 } else {
481 return String.valueOf((int) (1000000*total.getViolationLevel()/total.getReviews())) + (total.getHasWarnings() ? " (not accurate because of warnings)" : "");
482 }
483 }
484
485 public String getSigma() {
486 double p=1.0-total.getViolationLevel()/total.getReviews();
487 if (total.getReviews()==0) {
488 return "No results";
489 } else if (p<=0) {
490 return "Full incompliance";
491 } else if (p>=1) {
492 return "Full compliance";
493 } else {
494 return MessageFormat.format("{0,number,#.###}", new Object[] {new Double(SimpleAggregatedResults.normsinv(p)+1.5)}) + (total.getHasWarnings() ? " (not accurate because of warnings)" : "");
495 }
496 }
497
498 public Number getMaxSeverity() {
499 return total.getMaxSeverity();
500 }
501
502 public long getReviewsNumber() {
503 return total.getReviews();
504 }
505
506 public double getViolationLevel() {
507 return total.getViolationLevel();
508 }
509
510 public int getViolationsNumber() {
511 return (int) total.getViolations();
512 }
513
514 public int getWaivedViolationsNumber() {
515 return (int) total.getWaivedViolations();
516 }
517
518 public Date getDate() {
519 return new Date(total.getResultDate().getTime());
520 }
521
522}
523
524

Hammurapi 3 Copyright © 2004 Hammurapi Group. All Rights Reserved.