1 package org.apache.beehive.controls.runtime.generator; 2 19 20 import java.util.ArrayList ; 21 import java.util.HashMap ; 22 import java.util.Collection ; 23 24 import com.sun.mirror.declaration.ClassDeclaration; 25 import com.sun.mirror.declaration.MethodDeclaration; 26 import com.sun.mirror.declaration.ParameterDeclaration; 27 import com.sun.mirror.type.ClassType; 28 import com.sun.mirror.type.PrimitiveType; 29 import com.sun.mirror.type.ReferenceType; 30 import com.sun.mirror.type.TypeMirror; 31 32 import org.apache.beehive.controls.api.packaging.FeatureInfo; 33 34 35 42 public class AptMethodSet<T extends AptMethod> 43 { 44 48 public void add(T method) 49 { 50 _methods.add(method); 52 53 Object nameValue = _nameMap.get(method.getName()); 55 if (nameValue == null) 56 { 57 _nameMap.put(method.getName(), method); 59 } 60 else 61 { 62 int nextIndex; 63 if (nameValue instanceof AptMethod) 64 { 65 ((AptMethod)nameValue).setIndex(0); 67 nextIndex = 1; 68 } 69 else 70 { 71 nextIndex = ((Integer )nameValue).intValue(); 73 } 74 75 method.setIndex(nextIndex++); 76 _nameMap.put(method.getName(), nextIndex); 77 } 78 } 79 80 public Collection <T> getMethods() 81 { 82 return _methods; 83 } 84 85 public int size() 86 { 87 return _methods.size(); 88 } 89 90 HashMap _nameMap = new HashMap (); ArrayList <T> _methods = new ArrayList <T>(); 92 } 93 | Popular Tags |