1 26 27 package org.objectweb.openccm.ir3; 28 29 import org.omg.CORBA.*; 31 32 40 41 public class ArrayDef_impl 42 extends IRObject_impl 43 implements ArrayDefOperations 44 { 45 51 52 protected int length_; 53 54 55 protected IDLType_ref element_type_def_; 56 57 63 66 public 67 ArrayDef_impl(IFR ifr) 68 { 69 super(ifr); 71 72 setServant(new ArrayDefPOATie(this)); 74 75 length_ = 0; 77 78 element_type_def_ = new IDLType_ref(this); 80 } 81 82 88 92 protected TypeCode 93 recursiveType(java.util.List idSeq) 94 { 95 TypeCode tc = null; 96 try 97 { 98 Contained_impl cont = (Contained_impl)element_type_def_.getBaseImpl(); 99 int idx = idSeq.indexOf(cont.id()); 100 if (idx!=-1) 101 { 102 int dk = cont.def_kind().value(); 106 if (dk==DefinitionKind._dk_Alias) 107 { 108 AliasDef_impl alias = (AliasDef_impl)cont; 109 IDLType type = alias.original_type_def(); 110 dk = type.def_kind().value(); 111 AliasDef alias_def = null; 112 while (dk==DefinitionKind._dk_Alias) 113 { 114 alias_def = AliasDefHelper.narrow(type); 115 type = alias_def.original_type_def(); 116 dk = type.def_kind().value(); 117 } 118 } 119 120 if (dk!=DefinitionKind._dk_Value) 121 throw exceptionIllegalRecursion("array", cont.id()); 122 123 tc = getIFR().getTCF().create_recursive_tc(cont.id()); 124 } 125 } 126 catch (java.lang.ClassCastException ex) 127 { 128 } 129 130 if (tc==null) 131 tc = element_type_def_.recursiveType(idSeq); 132 133 return getIFR().getTCF().create_array_tc(length(), tc); 135 } 136 137 143 146 public ArrayDef 147 asArrayDef() 148 { 149 return ArrayDefHelper.narrow(asObject()); 150 } 151 152 158 161 protected void 162 cutDependencies() 163 { 164 element_type_def_.cutDependency(); 166 167 super.cutDependencies(); 169 } 170 171 177 180 public DefinitionKind 181 def_kind() 182 { 183 return DefinitionKind.dk_Array; 184 } 185 186 192 195 public TypeCode 196 type() 197 { 198 java.util.List idSeq = new java.util.ArrayList (); 200 return recursiveType(idSeq); 201 } 202 203 209 212 public int 213 length() 214 { 215 return length_; 216 } 217 218 221 public void 222 length(int val) 223 { 224 length_ = val; 225 } 226 227 230 public TypeCode 231 element_type() 232 { 233 return element_type_def_.recursiveType(); 235 } 236 237 240 public IDLType 241 element_type_def() 242 { 243 return element_type_def_.asIDLType(); 245 } 246 247 250 public void 251 element_type_def(IDLType val) 252 { 253 element_type_def_.setDependency( castToLocal(val) ); 256 } 257 } 258 | Popular Tags |