1 11 package org.eclipse.pde.internal.core; 12 13 import java.util.ArrayList ; 14 15 import org.eclipse.pde.core.plugin.ModelEntry; 16 17 public class PluginModelDelta { 18 public static final int ADDED = 1; 19 public static final int REMOVED = 2; 20 public static final int CHANGED = 4; 21 22 private ArrayList added; 23 private ArrayList removed; 24 private ArrayList changed; 25 26 private int kind = 0; 27 28 public PluginModelDelta() { 29 } 30 31 public int getKind() { 32 return kind; 33 } 34 public ModelEntry[] getAddedEntries() { 35 return getEntries(added); 36 } 37 public ModelEntry[] getRemovedEntries() { 38 return getEntries(removed); 39 } 40 public ModelEntry[] getChangedEntries() { 41 return getEntries(changed); 42 } 43 private ModelEntry[] getEntries(ArrayList list) { 44 if (list == null) 45 return new ModelEntry[0]; 46 return (ModelEntry[]) list.toArray(new ModelEntry[list.size()]); 47 } 48 49 void addEntry(ModelEntry entry, int type) { 50 switch (type) { 51 case ADDED : 52 added = addEntry(added, entry); 53 break; 54 case REMOVED : 55 removed = addEntry(removed, entry); 56 break; 57 case CHANGED : 58 changed = addEntry(changed, entry); 59 break; 60 } 61 kind |= type; 62 } 63 private ArrayList addEntry(ArrayList list, ModelEntry entry) { 64 if (list == null) 65 list = new ArrayList (); 66 list.add(entry); 67 return list; 68 } 69 } 70 | Popular Tags |