KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > gui > BugInstanceGroup


1 /*
2  * FindBugs - Find bugs in Java programs
3  * Copyright (C) 2003,2004 University of Maryland
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19
20 /*
21  * BugInstanceGroup.java
22  *
23  * Created on April 6, 2003, 11:31 AM
24  */

25
26 package edu.umd.cs.findbugs.gui;
27
28 /**
29  * A BugInstanceGroup represents a node in the bug tree which groups
30  * related bug instances. For example, it might group all of the bug instances
31  * for the same class.
32  *
33  * @author David Hovemeyer
34  */

35 public class BugInstanceGroup {
36
37     private String JavaDoc groupType;
38     private String JavaDoc groupName;
39     private int memberCount;
40
41     /**
42      * Creates a new instance of BugInstanceGroup.
43      *
44      * @param groupType string indicating why the bug instances in the group
45      * are related
46      * @param groupName name of the group (e.g., the class name if the group
47      * is all bug instances in the same class)
48      */

49     public BugInstanceGroup(String JavaDoc groupType, String JavaDoc groupName) {
50         this.groupType = groupType;
51         this.groupName = groupName;
52         this.memberCount = 0;
53     }
54
55     /**
56      * Get the group type.
57      */

58     public String JavaDoc getGroupType() {
59         return groupType;
60     }
61
62     /**
63      * Increment the member count (number of bug instances in this group).
64      */

65     public void incrementMemberCount() {
66         ++memberCount;
67     }
68
69     /**
70      * Get the member count (number of bug instances in this group).
71      */

72     public int getMemberCount() {
73         return memberCount;
74     }
75
76     /**
77      * Convert to string.
78      */

79     @Override JavaDoc
80     public String JavaDoc toString() {
81         StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
82         buf.append(groupName);
83         buf.append(" (");
84         buf.append(memberCount);
85         buf.append(")");
86         return buf.toString();
87     }
88
89 }
90
Popular Tags