1 18 package org.apache.batik.svggen; 19 20 import java.util.HashMap ; 21 import java.util.Map ; 22 23 30 public class SVGIDGenerator { 31 private Map prefixMap = new HashMap (); 32 33 public SVGIDGenerator() { 34 } 35 36 44 public String generateID(String prefix) { 45 Integer maxId = (Integer )prefixMap.get(prefix); 46 if (maxId == null) { 47 maxId = new Integer (0); 48 prefixMap.put(prefix, maxId); 49 } 50 51 maxId = new Integer (maxId.intValue()+1); 52 prefixMap.put(prefix, maxId); 53 return prefix + maxId; 54 } 55 } 56 | Popular Tags |