@@ -0,0 +1,1303 @@
+%0Apackage com.cflint;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map.Entry;%0Aimport java.util.Map;%0Aimport java.util.Set;%0A%0Apublic class BugCounts %7B%0A%09%09final public static String%5B%5D levels = new String%5B%5D %7B%22FATAL%22, %22CRITICAL%22, %22ERROR%22, %22WARNING%22, %22CAUTION%22, %22INFO%22, %22COSMETIC%22%7D;%0A%0A%0A%09%09protected Map%3CString, Integer%3E severityCounts = new HashMap%3CString, Integer%3E();%0A%09%09protected Map%3CString, Integer%3E bugCounts = new HashMap%3CString, Integer%3E();%0A%09%09protected int noBugs = 0;%0A%0A%09%09public void add(String code, String severity) %7B%0A%09%09%09if (bugCounts.get(code) == null) %7B%0A%09%09%09%09bugCounts.put(code, 1);%0A%09%09%09%7D%0A%09%09%09else %7B%0A%09%09%09%09bugCounts.put(code, bugCounts.get(code) + 1);%0A%09%09%09%7D%0A%0A%09%09%09if (severityCounts.get(severity) == null) %7B%0A%09%09%09%09severityCounts.put(severity, 1);%0A%09%09%09%7D%0A%09%09%09else %7B%0A%09%09%09%09severityCounts.put(severity, severityCounts.get(severity) + 1);%0A%09%09%09%7D%0A%09%09%09noBugs++;%0A%09%09%7D%0A%0A%09%09public int noBugs() %7B%0A%09%09%09return noBugs;%0A%09%09%7D%0A%0A%09%09public int noBugTypes() %7B%0A%09%09%09return bugCounts.size();%0A%09%09%7D%0A%0A%09%09public Set%3CString%3E bugTypes() %7B%0A%09%09%09return bugCounts.keySet();%0A%09%09%7D%0A%0A%09%09public int getCode(String code) %7B%0A%09%09%09if (bugCounts.get(code) != null) %7B%0A%09%09%09%09return bugCounts.get(code);%0A%09%09%09%7D%0A%0A%09%09%09return 0;%0A%09%09%7D%0A%0A%09%09public int getSeverity(String severity) %7B%0A%09%09%09if (severityCounts.get(severity) != null) %7B%0A%09%09%09%09return severityCounts.get(severity);%0A%09%09%09%7D%0A%0A%09%09%09return 0;%0A%09%09%7D%0A%7D

refactor bug count into their own class