| 1 package csdl.jblanket.util; 2 3 import csdl.jblanket.modifier.MethodCollector; 4 5 import java.io.File ; 6 import java.util.HashMap ; 7 import java.util.Map ; 8 import java.util.Set ; 9 10 34 public class MethodCategories { 35 36 37 private static MethodCategories theInstance = null; 38 39 private Map categories; 40 41 private String jblanketDir; 42 43 44 private MethodCategories() { 45 46 this.categories = new HashMap (); 47 this.jblanketDir = MethodCollector.getJBlanketDir(); 48 } 49 50 55 public static MethodCategories getInstance() { 56 57 if (MethodCategories.theInstance == null) { 58 MethodCategories.theInstance = new MethodCategories(); 59 } 60 61 return MethodCategories.theInstance; 62 } 63 64 75 public void addCategory(String category) { 76 this.addCategory(category, DefaultFileName.getDefaultFileName(category)); 77 } 78 79 90 public void addCategory(String category, String fileName) { 91 92 if (fileName == null) { 93 this.categories.put(category, null); 94 } 95 else { 96 this.categories.put(category, this.jblanketDir + File.separator + fileName); 97 } 98 } 99 100 107 public String getFileName(String category) { 108 109 String fileName = (String ) this.categories.get(category); 110 if (fileName == null) { 111 addCategory(category); 112 fileName = (String ) this.categories.get(category); 113 } 114 115 return fileName; 116 } 117 118 123 public Set getCategories() { 124 return this.categories.keySet(); 125 } 126 } | Popular Tags |