KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hammurapi > results > simple > SimpleDetailedResults


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  */

23
24 package org.hammurapi.results.simple;
25
26 import java.io.Serializable JavaDoc;
27 import java.util.Collection JavaDoc;
28 import java.util.LinkedList JavaDoc;
29 import java.util.List JavaDoc;
30
31 import org.hammurapi.HammurapiException;
32 import org.hammurapi.Violation;
33 import org.hammurapi.Waiver;
34 import org.hammurapi.WaiverEntry;
35 import org.hammurapi.WaiverSet;
36 import org.hammurapi.results.DetailedResults;
37
38 /**
39  *
40  * @author Pavel Vlasov
41  * @version $Revision: 1.2 $
42  */

43 public class SimpleDetailedResults extends SimpleNamedResults implements DetailedResults {
44     /**
45      * Comment for <code>serialVersionUID</code>
46      */

47     private static final long serialVersionUID = 4368844541348791240L;
48     private List JavaDoc violations=new LinkedList JavaDoc();
49     private List JavaDoc waivedViolations=new LinkedList JavaDoc();
50     private List JavaDoc incompleteMessages=new LinkedList JavaDoc();
51     
52     SimpleDetailedResults(String JavaDoc name, WaiverSet waiverSet) {
53         super(name, waiverSet);
54     }
55     
56     public Waiver addViolation(final Violation violation) throws HammurapiException {
57         final Waiver waiver=super.addViolation(violation);
58         if (waiver==null) {
59             violations.add(violation);
60         } else {
61             waivedViolations.add(new WaiverEntry() {
62                 /**
63                  * Comment for <code>serialVersionUID</code>
64                  */

65                 private static final long serialVersionUID = -6057980823743605352L;
66
67                 public Waiver getWaiver() {
68                     return waiver;
69                 }
70
71                 public Violation getViolation() {
72                     return violation;
73                 }
74             });
75         }
76         return waiver;
77     }
78     
79     public Collection JavaDoc getViolations() {
80         return violations;
81
82     }
83     
84     public int getViolationsNumber() {
85         return violations.size()+super.getViolationsNumber();
86     }
87
88     public Collection JavaDoc getWaivedViolations() {
89         return waivedViolations;
90     }
91     
92 }
93
Popular Tags