1 package com.sun.org.apache.bcel.internal.util; 2 3 56 import java.util.HashMap ; 57 import java.util.Collection ; 58 import com.sun.org.apache.bcel.internal.classfile.JavaClass; 59 60 69 public class ClassSet implements java.io.Serializable { 70 private HashMap _map = new HashMap (); 71 72 public boolean add(JavaClass clazz) { 73 boolean result = false; 74 75 if(!_map.containsKey(clazz.getClassName())) { 76 result = true; 77 _map.put(clazz.getClassName(), clazz); 78 } 79 80 return result; 81 } 82 83 public void remove(JavaClass clazz) { _map.remove(clazz.getClassName()); } 84 public boolean empty() { return _map.isEmpty(); } 85 86 public JavaClass[] toArray() { 87 Collection values = _map.values(); 88 JavaClass[] classes = new JavaClass[values.size()]; 89 values.toArray(classes); 90 return classes; 91 } 92 93 public String [] getClassNames() { 94 return (String [])_map.keySet().toArray(new String [_map.keySet().size()]); 95 } 96 } 97 | Popular Tags |