1 27 package org.objectweb.openccm.Containers.MetaInformation; 28 29 import org.objectweb.ccm.util.Table; 30 import org.omg.CORBA.LocalObject ; 31 import org.omg.Components.InvalidName; 32 33 39 public class ReceptaclePortInstanceListImpl 40 extends LocalObject 41 implements ReceptaclePortInstanceList 42 { 43 44 private Table _receptacles; 45 46 public ReceptaclePortInstanceListImpl() 47 { 48 _receptacles = new Table(); 49 } 50 51 54 public ReceptaclePortInstance 55 get_receptacle_port_instance(String name) 56 throws InvalidName 57 { 58 ReceptaclePortInstance result = (ReceptaclePortInstance) _receptacles.get(name); 59 if(result == null) 60 throw new InvalidName(); 61 return result; 62 } 63 64 67 public ReceptaclePortInstance[] 68 get_named_receptacle_port_instanceS(String [] names) 69 throws InvalidName 70 { 71 ReceptaclePortInstance[] result = new ReceptaclePortInstance[names.length]; 72 73 75 int i = 0; 76 for(i=0;i<names.length;i++) 77 { 78 result[i] = (ReceptaclePortInstance)_receptacles.get(names[i]); 79 80 if(result[i] == null) 81 { 82 throw new InvalidName(); 83 } 84 } 85 86 return result; 87 } 88 89 92 public ReceptaclePortInstance[] 93 get_all_receptacle_port_instanceS() 94 { 95 ReceptaclePortInstance[] result = new ReceptaclePortInstance[_receptacles.size()]; 96 97 int idx = 0; 99 for(java.util.Enumeration elements = _receptacles.elements(); elements.hasMoreElements(); ) 100 { 101 ReceptaclePortInstance info = (ReceptaclePortInstance)elements.nextElement(); 102 result[idx++] = info; 103 } 104 return result; 105 } 106 107 110 public void 111 add_receptacle_port_instance(ReceptaclePortInstance rpi) 112 { 113 String key = rpi.type_reference().name() ; _receptacles.put(key,rpi); 115 } 116 117 120 public void 121 remove_receptacle_port_instance(String name) 122 throws InvalidName 123 { 124 Object result = _receptacles.remove(name); 125 126 if (result == null) throw new InvalidName(); 127 } 128 } 129 | Popular Tags |