1 2 package SOFA.SOFAnode.Made.CDL; 3 import SOFA.SOFAnode.Made.TIR.CDLRepository; 4 import SOFA.SOFAnode.Made.TIR.Container; 5 6 abstract class CompContainerIm extends CompObjectIm implements CompContainer { 7 public List cont; 8 public CompContainerIm(int okind) { 9 super(okind); 10 cont = new List(); 11 } 12 13 public CompContained[] contents() { 14 CompContained[] ret = new CompContained [cont.size()]; 15 cont.toFirst(); 16 for(int i=0;i<cont.size();i++) { 17 ret[i] = (CompContained) cont.aktual(); 18 cont.toNext(); 19 } 20 return ret; 21 } 22 23 public CompContained lookup(String name, String ver) { 24 CompContained ret = null; 25 cont.toFirst(); 26 for(int i=0;i<cont.size();i++) { 27 if (((CompContained) cont.aktual()).getIdent().isEqual(name,ver)) { 28 ret = (CompContained) cont.aktual(); 29 break; 30 } 31 cont.toNext(); 32 } 33 return ret; 34 } 35 36 public CompContained[] lookup(String name) { 37 CompContained[] pom = new CompContained [cont.size()]; 38 int i,j = 0; 39 cont.toFirst(); 40 for(i=0;i<cont.size();i++) { 41 if (((CompContained) cont.aktual()).getIdent().isNameEqual(name)) { 42 pom[j] = (CompContained) cont.aktual(); 43 j++; 44 } 45 cont.toNext(); 46 } 47 CompContained[] ret = new CompContained [j]; 48 for(i=0;i<j;i++) 49 ret[i]=pom[i]; 50 return ret; 51 } 52 53 public CompContained lookupTag(String name, String tag) { 54 CompContained ret = null; 55 cont.toFirst(); 56 for(int i=0;i<cont.size();i++) { 57 if (((CompContained) cont.aktual()).getIdent().isTagEqual(name,tag)) { 58 ret = (CompContained) cont.aktual(); 59 break; 60 } 61 cont.toNext(); 62 } 63 return ret; 64 } 65 66 public boolean addObject(CompContained o) { 67 cont.toFirst(); 68 for (int i=0;i<cont.size();i++) { 69 if (((CompContained) cont.aktual()).getIdent().isNameEqual(o.getIdent().name)) 70 return false; 71 cont.toNext(); 72 } 73 cont.add(o); 74 return true; 75 } 76 77 public boolean isContainer() {return true;} 78 79 public void addToNormal(Container obj, CDLRepository normRep, java.util.ArrayList delayed) throws CDLExceptToNormal, CDLExceptRemote, CDLExceptLock { 80 } 82 } 83 | Popular Tags |