1 32 package net.sf.retrotranslator.transformer; 33 34 import java.util.*; 35 36 39 class MethodCounter { 40 41 private Map<String , Integer > methods = new HashMap<String , Integer >(); 42 43 public void increment(String name, String desc) { 44 String key = name + desc; 45 Integer count = methods.get(key); 46 methods.put(key, (count == null ? 0 : count) + 1); 47 } 48 49 public boolean isRepetitive(String name, String desc) { 50 return methods.get(name + desc) > 1; 51 } 52 53 public void decrement(String name, String desc) { 54 String key = name + desc; 55 methods.put(key, methods.get(key) - 1); 56 } 57 58 public boolean containsDuplicates() { 59 for (Integer count : methods.values()) { 60 if (count > 1) return true; 61 } 62 return false; 63 } 64 65 } 66 | Popular Tags |