1 11 12 package org.eclipse.core.internal.dependencies; 13 14 15 18 public class ElementChange { 19 20 public final static int ADDED = 0x01; 21 public final static int LINKAGE_CHANGED = 0x10; 22 public final static int REMOVED = 0x02; 23 public final static int RESOLVED = 0x04; 24 public final static int UNRESOLVED = 0x08; 25 public final static int UPDATED = ADDED | REMOVED; 26 private Element element; 27 private int kind; 28 29 ElementChange(Element element, int kind) { 30 this.element = element; 31 this.kind = kind; 32 } 33 34 37 38 public Element getElement() { 39 return element; 40 } 41 44 45 public int getKind() { 46 return kind; 47 } 48 49 private String getStatusName(int status) { 50 StringBuffer statusStr = new StringBuffer (); 51 if ((status & ADDED) != 0) 52 statusStr.append("ADDED|"); if ((status & REMOVED) != 0) 54 statusStr.append("REMOVED|"); if ((status & RESOLVED) != 0) 56 statusStr.append("RESOLVED|"); if ((status & UNRESOLVED) != 0) 58 statusStr.append("UNRESOLVED|"); if ((status & LINKAGE_CHANGED) != 0) 60 statusStr.append("LINKAGE_CHANGED|"); if (statusStr.length() == 0) 62 statusStr.append("UNKNOWN"); else 64 statusStr.deleteCharAt(statusStr.length() - 1); 65 return statusStr.toString(); 66 } 67 68 public Object getVersionId() { 69 return element.getVersionId(); 70 } 71 72 void setKind(int kind) { 73 this.kind = kind; 74 } 75 76 public String toString() { 77 StringBuffer result = new StringBuffer (); 78 result.append(element.getId()); 79 result.append('_'); 80 result.append(getVersionId()); 81 result.append(" ("); result.append(getStatusName(getKind())); 83 result.append(')'); 84 return result.toString(); 85 } 86 } | Popular Tags |