1 17 18 package org.objectweb.jac.aspects.gui; 19 20 import java.util.Map ; 21 import gnu.regexp.*; 22 23 27 28 public class WrappableMap 29 { 30 private Map delegate; 31 32 protected Map getDelegate() { 33 return delegate; 34 } 35 36 public WrappableMap(Map delegate) { 37 this.delegate = delegate; 38 } 39 40 47 48 public void put ( String key, Integer value ) 49 throws REException 50 { 51 Object keys[] = delegate.keySet().toArray(); 52 RE re = new RE(key); 53 for (int i=0; i<keys.length;i++) { 54 String cur_key = (String )keys[i]; 55 if (re.isMatch(cur_key)) 56 delegate.put(cur_key, value); 57 } 58 } 59 60 public void clear ( ) { 61 delegate.clear(); 62 } 63 64 public Object remove ( String key ) { 65 return delegate.remove(key); 66 } 67 68 static public String [] getCategories(WrappableMap wmap ) { 69 java.util.Set keys = wmap.getDelegate().keySet(); 70 String [] result = new String [keys.size()]; 71 java.util.Iterator i = keys.iterator(); 72 int j=0; 73 while (i.hasNext()) { 74 result[j++] = (String )i.next(); 75 } 76 return result; 77 } 78 79 static public Integer [] getLevels(WrappableMap wmap) { 80 return new Integer [] {new Integer (0),new Integer (1), 81 new Integer (2),new Integer (3)}; 82 } 83 } 84 | Popular Tags |