1 2 package SOFA.SOFAnode.Made.CodeGen; 3 4 import SOFA.SOFAnode.Made.TIR.Contained; 5 import SOFA.SOFAnode.Made.TIR.Identification; 6 7 11 class ObjectList extends java.util.ArrayList { 12 16 public Contained getObject(int index) { 17 return (Contained) get(index); 18 } 19 20 26 public Contained getObject(String absName, String ver) throws java.rmi.RemoteException { 27 Contained obj; 28 for (int i=0;i<size();i++) { 29 if ((obj = getObject(i)).get_identification().is_equal(absName, ver)) 30 return obj; 31 } 32 return null; 33 } 34 35 41 public boolean containsObject(String absName, String ver) throws java.rmi.RemoteException { 42 for (int i=0;i<size();i++) { 43 if (getObject(i).get_identification().is_equal(absName, ver)) 44 return true; 45 } 46 return false; 47 } 48 49 54 public boolean containsObject(Contained obj) throws java.rmi.RemoteException { 55 Identification idl = obj.get_identification(); 56 for (int i=0;i<size();i++) { 57 if (getObject(i).get_identification().is_equal(idl.absolute_name().name(), idl.version())) 58 return true; 59 } 60 return false; 61 } 62 63 68 public void addObject(Contained obj) throws java.rmi.RemoteException { 69 Identification idl = obj.get_identification(); 70 Contained inObj; 71 if ((inObj=getObject(idl.absolute_name().name(), idl.version()))==null) { 72 add(obj); 73 } 77 } 78 79 86 public int indexOfObject(String absName, String ver) throws java.rmi.RemoteException { 87 for (int i=0;i<size();i++) { 88 if (getObject(i).get_identification().is_equal(absName, ver)) 89 return i; 90 } 91 return -1; 92 } 93 94 99 public void mergeTogether(ObjectList obj) throws java.rmi.RemoteException { 100 if (obj!=null) { 101 for (int i=0; i<obj.size();i++) { 102 addObject(obj.getObject(i)); 103 } 104 } 105 } 106 } 107 | Popular Tags |