1 11 12 package org.eclipse.jdt.internal.corext.refactoring.generics; 13 14 import java.util.ArrayList ; 15 import java.util.HashMap ; 16 import java.util.List ; 17 18 import org.eclipse.core.runtime.Assert; 19 20 import org.eclipse.jdt.core.ICompilationUnit; 21 22 import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.CastVariable2; 23 import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.CollectionElementVariable2; 24 25 public class InferTypeArgumentsUpdate { 26 public static class CuUpdate { 27 private List fDeclarations= new ArrayList (); 28 private List fCastsToRemove= new ArrayList (); 29 30 public List getDeclarations() { 31 return fDeclarations; 32 } 33 34 public List getCastsToRemove() { 35 return fCastsToRemove; 36 } 37 } 38 39 private HashMap fUpdates= new HashMap (); 40 41 public HashMap getUpdates() { 42 return fUpdates; 43 } 44 45 public void addDeclaration(CollectionElementVariable2 elementCv) { 46 ICompilationUnit cu= elementCv.getCompilationUnit(); 47 if (cu == null) 48 return; 49 CuUpdate update= getUpdate(cu); 50 update.fDeclarations.add(elementCv); 51 } 52 53 public void addCastToRemove(CastVariable2 castCv) { 54 ICompilationUnit cu= castCv.getCompilationUnit(); 55 CuUpdate update= getUpdate(cu); 56 update.fCastsToRemove.add(castCv); 57 } 58 59 private CuUpdate getUpdate(ICompilationUnit cu) { 60 Assert.isNotNull(cu); 61 Object obj= fUpdates.get(cu); 62 CuUpdate update; 63 if (obj == null) { 64 update= new CuUpdate(); 65 fUpdates.put(cu, update); 66 } else { 67 update= (CuUpdate) obj; 68 } 69 return update; 70 } 71 72 } 73 | Popular Tags |