1 11 12 package org.eclipse.pde.internal.ui.wizards.cheatsheet; 13 14 import java.util.HashMap ; 15 16 20 public class CSCategoryTrackerUtil { 21 22 public final static int F_TYPE_NO_CATEGORY = 0; 23 24 public final static int F_TYPE_NEW_CATEGORY = 1; 25 26 public final static int F_TYPE_OLD_CATEGORY = 2; 27 28 private HashMap fCategoryNameMap; 29 30 private HashMap fCategoryIDMap; 31 32 private HashMap fCategoryTypeMap; 33 34 37 public CSCategoryTrackerUtil() { 38 39 fCategoryIDMap = new HashMap (); 43 44 fCategoryNameMap = new HashMap (); 48 49 50 fCategoryTypeMap = new HashMap (); 54 55 } 56 57 61 public void associate(String id, String name, int type) { 62 fCategoryNameMap.put(name, id); 63 fCategoryIDMap.put(id, name); 64 fCategoryTypeMap.put(id, new Integer (type)); 65 } 66 67 71 public boolean containsCategoryName(String name) { 72 return fCategoryNameMap.containsKey(name); 73 } 74 75 79 public boolean containsCategoryID(String id) { 80 return fCategoryIDMap.containsKey(id); 81 } 82 83 87 public String getCategoryName(String id) { 88 return (String )fCategoryIDMap.get(id); 89 } 90 91 95 public String getCategoryID(String name) { 96 return (String )fCategoryNameMap.get(name); 97 } 98 99 103 public int getCategoryType(String id) { 104 Integer integer = (Integer )fCategoryTypeMap.get(id); 105 if (integer == null) { 106 return F_TYPE_NO_CATEGORY; 107 } 108 return integer.intValue(); 109 } 110 111 } 112 | Popular Tags |