1 26 package net.sf.javaguard; 27 28 import java.util.Enumeration ; 29 import java.util.Hashtable ; 30 31 32 38 abstract public class NameMaker { 39 40 protected static Hashtable frequency = new Hashtable (); 41 42 43 44 46 public static Enumeration getNames() { 47 return frequency.keys(); 48 } 49 50 51 54 public static Enumeration getUseCounts() { 55 return frequency.elements(); 56 } 57 58 59 60 63 public String nextName(String descriptor) { 64 String name = getNextName(descriptor); 66 Integer intCount = (Integer )frequency.get(name); 67 if (intCount == null) { 68 frequency.put(name, new Integer (0)); 69 } 70 else { 71 frequency.remove(name); 72 frequency.put(name, new Integer (intCount.intValue() + 1)); 73 } 74 return name; 75 } 76 77 78 81 abstract protected String getNextName(String descriptor); 82 } 83 | Popular Tags |