ottlinger commented on code in PR #240:
URL: https://github.com/apache/creadur-rat/pull/240#discussion_r1581906646


##########
apache-rat-core/src/main/java/org/apache/rat/report/claim/ClaimStatistic.java:
##########
@@ -57,45 +58,71 @@ public int getCounter(Counter counter) {
         return count == null ? 0 : count[0];
     }
 
-    /**
-     * @return Returns a map with the file types. The map keys
-     * are file type names and the map values
-     * are integers with the number of resources matching
-     * the file type.
-     */
-    public Map<Counter, int[]> getCounterMap() {
-        return counterMap;
+    public void incCounter(Counter key, int value) {
+        final int[] num = counterMap.get(key);
+
+        if (num == null) {
+            counterMap.put(key, new int[] { value });
+        } else {
+            num[0] += value;
+        }
     }
 
-    
     /**
-     * @return Returns a map with the file types. The map keys
-     * are file type names and the map values
-     * are integers with the number of resources matching
-     * the file type.
+     * Returns the counts for the counter.
+     * @param documentType the document type to get the counter for.
+     * @return Returns the number of files with approved licenses.
      */
-    public Map<Document.Type, int[]> getDocumentCategoryMap() {
-        return documentCategoryMap;
+    public int getCounter(Document.Type documentType) {
+        int[] count = documentCategoryMap.get(documentType);
+        return count == null ? 0 : count[0];
     }
 
-    /**
-     * @return Returns a map with the license family codes. The map
-     * keys are license family category names,
-     * the map values are integers with the number of resources
-     * matching the license family code.
-     */
-    public Map<String, int[]> getLicenseFamilyCodeMap() {
-        return licenseFamilyCodeMap;
+    public void incCounter(Document.Type documentType, int value) {
+        final int[] num = documentCategoryMap.get(documentType);
+
+        if (num == null) {
+            documentCategoryMap.put(documentType, new int[] { value });
+        } else {
+            num[0] += value;

Review Comment:
   AtomicInteger to be threadsafe?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@creadur.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to