1 2 package SOFA.SOFAnode.Made.CDL; 3 import SOFA.SOFAnode.Made.TIR.Identification; 4 5 class ID { 6 public static final String lang = "cdl"; 7 8 public int isin; public String name; 11 public String version; 12 public String tag; 13 14 public int what; public boolean exist; 17 public Identification id; 19 public ID(String name, String vt) { 20 what = 0; exist = false; id = null; 21 this.name = new String (name); 22 id = null; 23 if (vt == null || vt.length()==0) { 24 isin = IDKind.none; 25 tag = null; 26 version = null; 27 } else { 28 if (vt.indexOf('!')==-1) { 29 version = null; 30 isin = IDKind.tag; 31 tag = new String (vt); 32 } else { 33 version = new String (vt); 34 isin = IDKind.version; 35 tag = null; 36 } 37 } 38 } 39 40 public void setVersion(String vt) { 41 what = 0; exist = false; id = null; 42 if (vt == null || vt.length()==0) { 43 isin = IDKind.none; 44 tag = null; 45 version = null; 46 } else { 47 if (vt.indexOf('!')==-1) { 48 version = null; 49 isin = IDKind.tag; 50 tag = new String (vt); 51 } else { 52 version = new String (vt); 53 isin = IDKind.version; 54 tag = null; 55 } 56 } 57 } 58 59 public boolean isEqual(String nm, String ver) { 60 if (isin==IDKind.version || isin==IDKind.versiontag) 61 if ((nm.compareTo(name)==0)&&(ver.compareTo(version)==0)) 62 return true; 63 return false; 64 } 65 66 public boolean isNameEqual(String nm) { 67 if (nm.compareTo(name)==0) 68 return true; 69 return false; 70 } 71 72 public boolean isTagEqual(String nm, String t) { 73 if (isin==IDKind.tag || isin==IDKind.versiontag) 74 if ((nm.compareTo(name)==0)&&(t.compareTo(tag)==0)) 75 return true; 76 return false; 77 } 78 79 public String toString() { 80 StringBuffer ret = new StringBuffer (name); 81 switch (isin) { 82 case IDKind.versiontag: 83 case IDKind.version: ret.append("::"+version); break; 84 case IDKind.tag: ret.append("::"+tag); break; 85 } 86 return ret.toString(); 87 } 88 } 89 | Popular Tags |