
package com.cflint;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class BugCounts {
    final public static String[] levels = new String[] { "FATAL", "CRITICAL", "ERROR", "WARNING", "CAUTION", "INFO",
            "COSMETIC" };

    protected Map<String, Integer> severityCounts = new HashMap<String, Integer>();
    protected Map<String, Integer> bugCounts = new HashMap<String, Integer>();
    protected int noBugs = 0;

    public void add(final String code, final String severity) {
        if (bugCounts.get(code) == null) {
            bugCounts.put(code, 1);
        } else {
            bugCounts.put(code, bugCounts.get(code) + 1);
        }

        if (severityCounts.get(severity) == null) {
            severityCounts.put(severity, 1);
        } else {
            severityCounts.put(severity, severityCounts.get(severity) + 1);
        }
        noBugs++;
    }

    public int noBugs() {
        return noBugs;
    }

    public int noBugTypes() {
        return bugCounts.size();
    }

    public Set<String> bugTypes() {
        return bugCounts.keySet();
    }

    public int getCode(final String code) {
        if (bugCounts.get(code) != null) {
            return bugCounts.get(code);
        }

        return 0;
    }

    public int getSeverity(final String severity) {
        if (severityCounts.get(severity) != null) {
            return severityCounts.get(severity);
        }

        return 0;
    }
}
@@ -115,152 +115,8 @@
 s %7B%0A
-    final public static String%5B%5D levels = new String%5B%5D %7B %22FATAL%22, %22CRITICAL%22, %22ERROR%22, %22WARNING%22, %22CAUTION%22, %22INFO%22,%0A            %22COSMETIC%22 %7D;%0A%0A
     
@@ -121,38 +121,38 @@
   protected Map%3C
-String
+Levels
 , Integer%3E sever
@@ -167,38 +167,38 @@
 s = new HashMap%3C
-String
+Levels
 , Integer%3E();%0A  
@@ -346,30 +346,30 @@
 code, final 
-String
+Levels
  severity) %7B
@@ -1159,22 +1159,22 @@
 y(final 
-String
+Levels
  severit

remove array of levels and use new enum