1 2 package SOFA.SOFAnode.Made.CDL; 3 4 class Scopename { 5 public List names; 6 7 public Scopename() { 8 names = new List(); 9 } 10 11 public void addScope(String name) { 12 if (name != null && name.length()!=0) { 13 names.add(name); 14 } 15 } 16 17 public void prependScope(String name) { 18 if (name != null && name.length()!=0) { 19 names.prepend(name); 20 } 21 } 22 23 public long length() { return names.size(); } 24 25 public void removeScope() { 26 names.toLast(); 27 names.removeAkt(); 28 } 29 30 public String toString() { 31 StringBuffer ret = new StringBuffer ("::"); 32 names.toFirst(); 33 for (int i=0;i<names.size();i++) { 34 ret.append((String ) names.aktual()); 35 if (i!= names.size()-1) 36 ret.append("::"); 37 names.toNext(); 38 } 39 return ret.toString(); 40 } 41 42 public boolean equal(Scopename s) { 43 if (names.size() != s.names.size()) 44 return false; 45 names.toFirst(); 46 s.names.toFirst(); 47 for(int i=0;i<names.size();i++) { 48 if (((String ) names.aktual()).compareTo(((String ) s.names.aktual()))!=0) 49 return false; 50 names.toNext(); 51 s.names.toNext(); 52 } 53 return true; 54 } 55 } 56 | Popular Tags |