1 26 27 package org.objectweb.openccm.ir3; 28 29 import org.omg.CORBA.*; 31 32 40 41 public class UnionMembers 42 extends Members 43 { 44 50 51 protected Any[] labels_; 52 53 59 60 public 61 UnionMembers(UnionDef_impl owner) 62 { 63 super(owner, owner); 64 65 labels_ = null; 67 } 68 69 75 78 public UnionMember[] 79 getUnionMemberSeq(java.util.List idSeq) 80 { 81 UnionMember[] result = new UnionMember[names_.length]; 82 83 for(int i=0; i<result.length; i++) 84 { 85 result[i] = new UnionMember(); 86 result[i].name = names_[i]; 87 result[i].label = labels_[i]; 88 result[i].type = types_[i].recursiveType(idSeq); 90 result[i].type_def = types_[i].asIDLType(); 91 } 92 93 return result; 94 } 95 96 99 public UnionMember[] 100 getUnionMemberSeq() 101 { 102 UnionMember[] result = new UnionMember[names_.length]; 103 java.util.List idSeq = new java.util.ArrayList (); 104 105 for(int i=0; i<result.length; i++) 106 { 107 idSeq.clear(); 108 result[i] = new UnionMember(); 109 result[i].name = names_[i]; 110 result[i].label = labels_[i]; 111 result[i].type = types_[i].recursiveType(idSeq); 113 result[i].type_def = types_[i].asIDLType(); 114 } 115 116 return result; 117 } 118 119 122 public void 123 setUnionMemberSeq(UnionMember[] val) 124 { 125 127 String [] names = new String [val.length]; 129 for (int i=0; i<val.length; i++) 130 names[i] = val[i].name; 131 132 for(int i=0; i<names.length; i++) 133 { 134 String name = names[i]; 135 136 container_.checkName(name, false, false); 137 138 if (name.equalsIgnoreCase(contained_.name())) 139 contained_.exceptionNameAlreadyUsedByImmediateScope(name); 140 } 141 142 Any[] labels = new Any[val.length]; 144 for (int i=0; i<val.length; i++) 145 labels[i] = val[i].label; 146 147 IRObject_impl[] types = new IRObject_impl[val.length]; 148 for (int i=0; i<val.length; i++) 149 types[i] = contained_.castToLocal(val[i].type_def); 150 151 IDLType_ref[] refs = new IDLType_ref[val.length]; 152 for (int i=0; i<val.length; i++) 153 refs[i] = new IDLType_ref( container_, types[i] ); 154 155 labels_ = labels; 156 super.setNamesTypes(names, refs); 157 } 158 } 159 | Popular Tags |