1 17 package org.apache.bcel.util; 18 19 import java.util.Collection ; 20 import java.util.HashMap ; 21 import java.util.Map ; 22 import org.apache.bcel.classfile.JavaClass; 23 24 33 public class ClassSet implements java.io.Serializable { 34 35 private Map _map = new HashMap (); 36 37 38 public boolean add( JavaClass clazz ) { 39 boolean result = false; 40 if (!_map.containsKey(clazz.getClassName())) { 41 result = true; 42 _map.put(clazz.getClassName(), clazz); 43 } 44 return result; 45 } 46 47 48 public void remove( JavaClass clazz ) { 49 _map.remove(clazz.getClassName()); 50 } 51 52 53 public boolean empty() { 54 return _map.isEmpty(); 55 } 56 57 58 public JavaClass[] toArray() { 59 Collection values = _map.values(); 60 JavaClass[] classes = new JavaClass[values.size()]; 61 values.toArray(classes); 62 return classes; 63 } 64 65 66 public String [] getClassNames() { 67 return (String []) _map.keySet().toArray(new String [_map.keySet().size()]); 68 } 69 } 70 | Popular Tags |