1 2 3 // 4 // THIS FILE IS AUTOMATICALLY GENERATED!! 5 // 6 // Generated at 2009-08-09 by the VDM++ to JAVA Code Generator 7 // (v8.2.1b - Wed 15-Jul-2009 14:09:22) 8 // 9 // Supported compilers: jdk 1.4/1.5/1.6 10 // 11 12 // ***** VDMTOOLS START Name=HeaderComment KEEP=NO 13 // ***** VDMTOOLS END Name=HeaderComment 14 15 // ***** VDMTOOLS START Name=package KEEP=NO 16 package org.overturetool.umltrans.uml2vdm; 17 18 // ***** VDMTOOLS END Name=package 19 20 // ***** VDMTOOLS START Name=imports KEEP=YES 21 22 import jp.co.csk.vdm.toolbox.VDM.*; 23 import java.util.*; 24 import org.overturetool.ast.itf.*; 25 import org.overturetool.ast.imp.*; 26 import org.overturetool.api.io.*; 27 import org.overturetool.api.io.*; 28 import org.overturetool.api.*; 29 import org.overturetool.api.xml.*; 30 import org.overturetool.umltrans.*; 31 import org.overturetool.umltrans.api.Util; 32 import org.overturetool.umltrans.uml.*; 33 import org.overturetool.umltrans.uml2vdm.*; 34 import org.overturetool.umltrans.vdm2uml.*; 35 // ***** VDMTOOLS END Name=imports 36 37 38 39 public class Xml2UmlModel extends XmlVisitor { 40 41 // ***** VDMTOOLS START Name=vdmComp KEEP=NO 42 static UTIL.VDMCompare vdmComp = new UTIL.VDMCompare(); 43 // ***** VDMTOOLS END Name=vdmComp 44 45 // ***** VDMTOOLS START Name=result KEEP=NO 46 public IUmlModel result = null; 47 // ***** VDMTOOLS END Name=result 48 49 // ***** VDMTOOLS START Name=primiticeTypes KEEP=NO 50 private HashSet primiticeTypes = new HashSet(); 51 // ***** VDMTOOLS END Name=primiticeTypes 52 53 // ***** VDMTOOLS START Name=classes KEEP=NO 54 private HashSet classes = new HashSet(); 55 // ***** VDMTOOLS END Name=classes 56 57 // ***** VDMTOOLS START Name=associations KEEP=NO 58 private HashSet associations = new HashSet(); 59 // ***** VDMTOOLS END Name=associations 60 61 // ***** VDMTOOLS START Name=constraints KEEP=NO 62 private HashSet constraints = new HashSet(); 63 // ***** VDMTOOLS END Name=constraints 64 65 // ***** VDMTOOLS START Name=classesTypeMap KEEP=NO 66 private HashMap classesTypeMap = new HashMap(); 67 // ***** VDMTOOLS END Name=classesTypeMap 68 69 // ***** VDMTOOLS START Name=collaborations KEEP=NO 70 private HashSet collaborations = new HashSet(); 71 // ***** VDMTOOLS END Name=collaborations 72 73 // ***** VDMTOOLS START Name=idToclassesMap KEEP=NO 74 private HashMap idToclassesMap = new HashMap(); 75 // ***** VDMTOOLS END Name=idToclassesMap 76 77 // ***** VDMTOOLS START Name=idToOperationMap KEEP=NO 78 private HashMap idToOperationMap = new HashMap(); 79 // ***** VDMTOOLS END Name=idToOperationMap 80 81 // ***** VDMTOOLS START Name=idToClallEventMap KEEP=NO 82 private HashMap idToClallEventMap = new HashMap(); 83 // ***** VDMTOOLS END Name=idToClallEventMap 84 85 // ***** VDMTOOLS START Name=lifeLineMap KEEP=NO 86 private HashMap lifeLineMap = new HashMap(); 87 // ***** VDMTOOLS END Name=lifeLineMap 88 89 // ***** VDMTOOLS START Name=mosMap KEEP=NO 90 private HashMap mosMap = new HashMap(); 91 // ***** VDMTOOLS END Name=mosMap 92 93 // ***** VDMTOOLS START Name=besMap KEEP=NO 94 private HashMap besMap = new HashMap(); 95 // ***** VDMTOOLS END Name=besMap 96 97 // ***** VDMTOOLS START Name=combiMap KEEP=NO 98 private HashMap combiMap = new HashMap(); 99 // ***** VDMTOOLS END Name=combiMap 100 101 // ***** VDMTOOLS START Name=log KEEP=NO 102 private StatusLog log = null; 103 // ***** VDMTOOLS END Name=log 104 105 106 // ***** VDMTOOLS START Name=vdm_init_Xml2UmlModel KEEP=NO 107 private void vdm_init_Xml2UmlModel () throws CGException { 108 try { 109 110 result = null; 111 primiticeTypes = new HashSet(); 112 primiticeTypes.add(new String("char")); 113 primiticeTypes.add(new String("int")); 114 primiticeTypes.add(new String("bool")); 115 primiticeTypes.add(new String("String")); 116 primiticeTypes.add(new String("unlimitedNatural")); 117 classes = new HashSet(); 118 associations = new HashSet(); 119 constraints = new HashSet(); 120 classesTypeMap = new HashMap(); 121 collaborations = new HashSet(); 122 idToclassesMap = new HashMap(); 123 idToOperationMap = new HashMap(); 124 idToClallEventMap = new HashMap(); 125 lifeLineMap = new HashMap(); 126 mosMap = new HashMap(); 127 besMap = new HashMap(); 128 combiMap = new HashMap(); 129 log = (StatusLog) new StatusLog(); 130 } 131 catch (Exception e){ 132 133 e.printStackTrace(System.out); 134 System.out.println(e.getMessage()); 135 } 136 } 137 // ***** VDMTOOLS END Name=vdm_init_Xml2UmlModel 138 139 140 // ***** VDMTOOLS START Name=Xml2UmlModel KEEP=NO 141 public Xml2UmlModel () throws CGException { 142 vdm_init_Xml2UmlModel(); 143 } 144 // ***** VDMTOOLS END Name=Xml2UmlModel 145 146 147 // ***** VDMTOOLS START Name=Xml2UmlModel#1|StatusLog KEEP=NO 148 public Xml2UmlModel (final StatusLog l) throws CGException { 149 150 vdm_init_Xml2UmlModel(); 151 log = (StatusLog) UTIL.clone(l); 152 } 153 // ***** VDMTOOLS END Name=Xml2UmlModel#1|StatusLog 154 155 156 // ***** VDMTOOLS START Name=VisitXmlDocument#1|XmlDocument KEEP=NO 157 public void VisitXmlDocument (final XmlDocument doc) throws CGException { 158 159 XmlEntity root = null; 160 Vector unArg_2 = null; 161 XmlEntityList tmpRec_3 = null; 162 tmpRec_3 = doc.entities; 163 unArg_2 = tmpRec_3.entities; 164 root = (XmlEntity) unArg_2.get(0); 165 Vector firstPackageAndRoot = null; 166 Vector var1_5 = null; 167 XmlEntityList tmpRec_6 = null; 168 tmpRec_6 = root.entities; 169 var1_5 = tmpRec_6.entities; 170 Vector var2_8 = null; 171 var2_8 = new Vector(); 172 var2_8.add(root); 173 firstPackageAndRoot = (Vector) var1_5.clone(); 174 firstPackageAndRoot.addAll(var2_8); 175 XmlEntity model = null; 176 Vector unArg_10 = null; 177 { 178 179 Vector res_l_11 = new Vector(); 180 HashSet resBind_s_13 = new HashSet(); 181 HashSet riseq_17 = new HashSet(); 182 int max_18 = firstPackageAndRoot.size(); 183 for (int i_19 = 1; i_19 <= max_18; i_19++) 184 riseq_17.add(new Long(i_19)); 185 resBind_s_13 = riseq_17; 186 Vector bind_l_12 = null; 187 bind_l_12 = UTIL.Sort(resBind_s_13); 188 Long i = null; 189 for (Iterator enm_30 = bind_l_12.iterator(); enm_30.hasNext(); ) { 190 191 Long e_15 = UTIL.NumberToLong(enm_30.next()); 192 i = e_15; 193 Boolean pred_23 = null; 194 String var1_24 = null; 195 XmlEntity tmpRec_25 = null; 196 if ((1 <= i.intValue()) && (i.intValue() <= firstPackageAndRoot.size())) 197 tmpRec_25 = (XmlEntity) firstPackageAndRoot.get(i.intValue() - 1); 198 else 199 UTIL.RunTime("Run-Time Error:Illegal index"); 200 var1_24 = tmpRec_25.name; 201 pred_23 = new Boolean(UTIL.equals(var1_24, new String("uml:Model"))); 202 if (pred_23.booleanValue()) { 203 204 XmlEntity reselem_20 = null; 205 if ((1 <= i.intValue()) && (i.intValue() <= firstPackageAndRoot.size())) 206 reselem_20 = (XmlEntity) firstPackageAndRoot.get(i.intValue() - 1); 207 else 208 UTIL.RunTime("Run-Time Error:Illegal index"); 209 res_l_11.add(reselem_20); 210 } 211 } 212 unArg_10 = res_l_11; 213 } 214 model = (XmlEntity) unArg_10.get(0); 215 XmlEntity vdm_package = null; 216 Vector unArg_31 = null; 217 { 218 219 Vector res_l_32 = new Vector(); 220 HashSet resBind_s_34 = new HashSet(); 221 Vector unArg_37 = null; 222 XmlEntityList tmpRec_38 = null; 223 tmpRec_38 = model.entities; 224 unArg_37 = tmpRec_38.entities; 225 HashSet riseq_40 = new HashSet(); 226 int max_41 = unArg_37.size(); 227 for (int i_42 = 1; i_42 <= max_41; i_42++) 228 riseq_40.add(new Long(i_42)); 229 resBind_s_34 = riseq_40; 230 Vector bind_l_33 = null; 231 bind_l_33 = UTIL.Sort(resBind_s_34); 232 Long i = null; 233 for (Iterator enm_56 = bind_l_33.iterator(); enm_56.hasNext(); ) { 234 235 Long e_36 = UTIL.NumberToLong(enm_56.next()); 236 i = e_36; 237 Boolean pred_48 = null; 238 XmlEntity par_49 = null; 239 Vector tmp_l_50 = null; 240 XmlEntityList tmpRec_51 = null; 241 tmpRec_51 = model.entities; 242 tmp_l_50 = tmpRec_51.entities; 243 if ((1 <= i.intValue()) && (i.intValue() <= tmp_l_50.size())) 244 par_49 = (XmlEntity) tmp_l_50.get(i.intValue() - 1); 245 else 246 UTIL.RunTime("Run-Time Error:Illegal index"); 247 pred_48 = isAttributeType((XmlEntity) par_49, new String("uml:Package")); 248 if (pred_48.booleanValue()) { 249 250 XmlEntity reselem_43 = null; 251 Vector tmp_l_44 = null; 252 XmlEntityList tmpRec_45 = null; 253 tmpRec_45 = model.entities; 254 tmp_l_44 = tmpRec_45.entities; 255 if ((1 <= i.intValue()) && (i.intValue() <= tmp_l_44.size())) 256 reselem_43 = (XmlEntity) tmp_l_44.get(i.intValue() - 1); 257 else 258 UTIL.RunTime("Run-Time Error:Illegal index"); 259 res_l_32.add(reselem_43); 260 } 261 } 262 unArg_31 = res_l_32; 263 } 264 vdm_package = (XmlEntity) unArg_31.get(0); 265 { 266 267 Vector pes = null; 268 XmlEntityList tmpRec_59 = null; 269 tmpRec_59 = vdm_package.entities; 270 pes = tmpRec_59.entities; 271 { 272 273 HashMap rhs_61 = new HashMap(); 274 HashMap modmap_62 = new HashMap(); 275 HashMap res_m_65 = new HashMap(); 276 { 277 278 HashSet e_set_84 = new HashSet(); 279 HashSet riseq_86 = new HashSet(); 280 int max_87 = pes.size(); 281 for (int i_88 = 1; i_88 <= max_87; i_88++) 282 riseq_86.add(new Long(i_88)); 283 e_set_84 = riseq_86; 284 Long i = null; 285 { 286 for (Iterator enm_90 = e_set_84.iterator(); enm_90.hasNext(); ) { 287 288 Long elem_89 = UTIL.NumberToLong(enm_90.next()); 289 i = elem_89; 290 Boolean pred_78 = null; 291 XmlEntity par_79 = null; 292 if ((1 <= i.intValue()) && (i.intValue() <= pes.size())) 293 par_79 = (XmlEntity) pes.get(i.intValue() - 1); 294 else 295 UTIL.RunTime("Run-Time Error:Illegal index"); 296 pred_78 = isAttributeType((XmlEntity) par_79, new String("uml:Class")); 297 if (pred_78.booleanValue()) { 298 299 String md_66 = null; 300 XmlAttribute tmpRec_67 = null; 301 XmlEntity par_68 = null; 302 if ((1 <= i.intValue()) && (i.intValue() <= pes.size())) 303 par_68 = (XmlEntity) pes.get(i.intValue() - 1); 304 else 305 UTIL.RunTime("Run-Time Error:Illegal index"); 306 tmpRec_67 = (XmlAttribute) getAttribute((XmlEntity) par_68, new String("xmi:id")); 307 md_66 = tmpRec_67.val; 308 String mr_72 = null; 309 XmlAttribute tmpRec_73 = null; 310 XmlEntity par_74 = null; 311 if ((1 <= i.intValue()) && (i.intValue() <= pes.size())) 312 par_74 = (XmlEntity) pes.get(i.intValue() - 1); 313 else 314 UTIL.RunTime("Run-Time Error:Illegal index"); 315 tmpRec_73 = (XmlAttribute) getAttribute((XmlEntity) par_74, new String("name")); 316 mr_72 = tmpRec_73.val; 317 res_m_65.put(md_66, mr_72); 318 } 319 } 320 } 321 } 322 modmap_62 = res_m_65; 323 rhs_61 = new HashMap(classesTypeMap); 324 rhs_61.putAll(modmap_62); 325 classesTypeMap = (HashMap) UTIL.clone(rhs_61); 326 HashSet rhs_91 = new HashSet(); 327 HashSet var2_93 = new HashSet(); 328 HashSet res_s_94 = new HashSet(); 329 { 330 331 HashSet e_set_114 = new HashSet(); 332 HashSet riseq_116 = new HashSet(); 333 int max_117 = pes.size(); 334 for (int i_118 = 1; i_118 <= max_117; i_118++) 335 riseq_116.add(new Long(i_118)); 336 e_set_114 = riseq_116; 337 Long i = null; 338 { 339 for (Iterator enm_120 = e_set_114.iterator(); enm_120.hasNext(); ) { 340 341 Long elem_119 = UTIL.NumberToLong(enm_120.next()); 342 i = elem_119; 343 Boolean pred_99 = null; 344 Boolean var1_100 = null; 345 XmlEntity par_101 = null; 346 if ((1 <= i.intValue()) && (i.intValue() <= pes.size())) 347 par_101 = (XmlEntity) pes.get(i.intValue() - 1); 348 else 349 UTIL.RunTime("Run-Time Error:Illegal index"); 350 var1_100 = isAttributeType((XmlEntity) par_101, new String("uml:Class")); 351 { 352 if ((pred_99 = var1_100).booleanValue()) { 353 354 Boolean var2_105 = null; 355 String var1_106 = null; 356 XmlAttribute tmpRec_107 = null; 357 XmlEntity par_108 = null; 358 if ((1 <= i.intValue()) && (i.intValue() <= pes.size())) 359 par_108 = (XmlEntity) pes.get(i.intValue() - 1); 360 else 361 UTIL.RunTime("Run-Time Error:Illegal index"); 362 tmpRec_107 = (XmlAttribute) getAttribute((XmlEntity) par_108, new String("name")); 363 var1_106 = tmpRec_107.val; 364 var2_105 = new Boolean(!primiticeTypes.contains(var1_106)); 365 pred_99 = var2_105; 366 } 367 } 368 if (pred_99.booleanValue()) { 369 370 IUmlClass res_s_95 = null; 371 XmlEntity par_96 = null; 372 if ((1 <= i.intValue()) && (i.intValue() <= pes.size())) 373 par_96 = (XmlEntity) pes.get(i.intValue() - 1); 374 else 375 UTIL.RunTime("Run-Time Error:Illegal index"); 376 res_s_95 = (IUmlClass) exstractClass((XmlEntity) par_96); 377 res_s_94.add(res_s_95); 378 } 379 } 380 } 381 } 382 var2_93 = res_s_94; 383 rhs_91 = (HashSet) classes.clone(); 384 rhs_91.addAll(var2_93); 385 classes = (HashSet) UTIL.clone(rhs_91); 386 HashSet rhs_121 = new HashSet(); 387 HashSet var2_123 = new HashSet(); 388 HashSet res_s_124 = new HashSet(); 389 { 390 391 HashSet e_set_135 = new HashSet(); 392 HashSet riseq_137 = new HashSet(); 393 int max_138 = pes.size(); 394 for (int i_139 = 1; i_139 <= max_138; i_139++) 395 riseq_137.add(new Long(i_139)); 396 e_set_135 = riseq_137; 397 Long i = null; 398 { 399 for (Iterator enm_141 = e_set_135.iterator(); enm_141.hasNext(); ) { 400 401 Long elem_140 = UTIL.NumberToLong(enm_141.next()); 402 i = elem_140; 403 Boolean pred_129 = null; 404 XmlEntity par_130 = null; 405 if ((1 <= i.intValue()) && (i.intValue() <= pes.size())) 406 par_130 = (XmlEntity) pes.get(i.intValue() - 1); 407 else 408 UTIL.RunTime("Run-Time Error:Illegal index"); 409 pred_129 = isAttributeType((XmlEntity) par_130, new String("uml:Association")); 410 if (pred_129.booleanValue()) { 411 412 IUmlAssociation res_s_125 = null; 413 XmlEntity par_126 = null; 414 if ((1 <= i.intValue()) && (i.intValue() <= pes.size())) 415 par_126 = (XmlEntity) pes.get(i.intValue() - 1); 416 else 417 UTIL.RunTime("Run-Time Error:Illegal index"); 418 res_s_125 = (IUmlAssociation) build_uAssociation((XmlEntity) par_126); 419 res_s_124.add(res_s_125); 420 } 421 } 422 } 423 } 424 var2_123 = res_s_124; 425 rhs_121 = (HashSet) associations.clone(); 426 rhs_121.addAll(var2_123); 427 associations = (HashSet) UTIL.clone(rhs_121); 428 HashSet rhs_142 = new HashSet(); 429 HashSet var2_144 = new HashSet(); 430 HashSet res_s_145 = new HashSet(); 431 { 432 433 HashSet e_set_156 = new HashSet(); 434 HashSet riseq_158 = new HashSet(); 435 int max_159 = pes.size(); 436 for (int i_160 = 1; i_160 <= max_159; i_160++) 437 riseq_158.add(new Long(i_160)); 438 e_set_156 = riseq_158; 439 Long i = null; 440 { 441 for (Iterator enm_162 = e_set_156.iterator(); enm_162.hasNext(); ) { 442 443 Long elem_161 = UTIL.NumberToLong(enm_162.next()); 444 i = elem_161; 445 Boolean pred_150 = null; 446 XmlEntity par_151 = null; 447 if ((1 <= i.intValue()) && (i.intValue() <= pes.size())) 448 par_151 = (XmlEntity) pes.get(i.intValue() - 1); 449 else 450 UTIL.RunTime("Run-Time Error:Illegal index"); 451 pred_150 = isAttributeType((XmlEntity) par_151, new String("uml:Constraint")); 452 if (pred_150.booleanValue()) { 453 454 IUmlConstraint res_s_146 = null; 455 XmlEntity par_147 = null; 456 if ((1 <= i.intValue()) && (i.intValue() <= pes.size())) 457 par_147 = (XmlEntity) pes.get(i.intValue() - 1); 458 else 459 UTIL.RunTime("Run-Time Error:Illegal index"); 460 res_s_146 = (IUmlConstraint) build_uConstraint((XmlEntity) par_147); 461 res_s_145.add(res_s_146); 462 } 463 } 464 } 465 } 466 var2_144 = res_s_145; 467 rhs_142 = (HashSet) constraints.clone(); 468 rhs_142.addAll(var2_144); 469 constraints = (HashSet) UTIL.clone(rhs_142); 470 HashMap rhs_163 = new HashMap(); 471 HashSet par_164 = new HashSet(); 472 HashSet res_s_165 = new HashSet(); 473 { 474 475 HashSet e_set_175 = new HashSet(); 476 HashSet riseq_177 = new HashSet(); 477 int max_178 = pes.size(); 478 for (int i_179 = 1; i_179 <= max_178; i_179++) 479 riseq_177.add(new Long(i_179)); 480 e_set_175 = riseq_177; 481 Long i = null; 482 { 483 for (Iterator enm_181 = e_set_175.iterator(); enm_181.hasNext(); ) { 484 485 Long elem_180 = UTIL.NumberToLong(enm_181.next()); 486 i = elem_180; 487 Boolean pred_169 = null; 488 XmlEntity par_170 = null; 489 if ((1 <= i.intValue()) && (i.intValue() <= pes.size())) 490 par_170 = (XmlEntity) pes.get(i.intValue() - 1); 491 else 492 UTIL.RunTime("Run-Time Error:Illegal index"); 493 pred_169 = isAttributeType((XmlEntity) par_170, new String("uml:CallEvent")); 494 if (pred_169.booleanValue()) { 495 496 XmlEntity res_s_166 = null; 497 if ((1 <= i.intValue()) && (i.intValue() <= pes.size())) 498 res_s_166 = (XmlEntity) pes.get(i.intValue() - 1); 499 else 500 UTIL.RunTime("Run-Time Error:Illegal index"); 501 res_s_165.add(res_s_166); 502 } 503 } 504 } 505 } 506 par_164 = res_s_165; 507 rhs_163 = buildCallEventMap(par_164); 508 idToClallEventMap = (HashMap) UTIL.clone(rhs_163); 509 HashSet rhs_182 = new HashSet(); 510 HashSet var2_184 = new HashSet(); 511 HashSet res_s_185 = new HashSet(); 512 { 513 514 HashSet e_set_196 = new HashSet(); 515 HashSet riseq_198 = new HashSet(); 516 int max_199 = pes.size(); 517 for (int i_200 = 1; i_200 <= max_199; i_200++) 518 riseq_198.add(new Long(i_200)); 519 e_set_196 = riseq_198; 520 Long i = null; 521 { 522 for (Iterator enm_202 = e_set_196.iterator(); enm_202.hasNext(); ) { 523 524 Long elem_201 = UTIL.NumberToLong(enm_202.next()); 525 i = elem_201; 526 Boolean pred_190 = null; 527 XmlEntity par_191 = null; 528 if ((1 <= i.intValue()) && (i.intValue() <= pes.size())) 529 par_191 = (XmlEntity) pes.get(i.intValue() - 1); 530 else 531 UTIL.RunTime("Run-Time Error:Illegal index"); 532 pred_190 = isAttributeType((XmlEntity) par_191, new String("uml:Collaboration")); 533 if (pred_190.booleanValue()) { 534 535 IUmlCollaboration res_s_186 = null; 536 XmlEntity par_187 = null; 537 if ((1 <= i.intValue()) && (i.intValue() <= pes.size())) 538 par_187 = (XmlEntity) pes.get(i.intValue() - 1); 539 else 540 UTIL.RunTime("Run-Time Error:Illegal index"); 541 res_s_186 = (IUmlCollaboration) build_uCollobration((XmlEntity) par_187); 542 res_s_185.add(res_s_186); 543 } 544 } 545 } 546 } 547 var2_184 = res_s_185; 548 rhs_182 = (HashSet) collaborations.clone(); 549 rhs_182.addAll(var2_184); 550 collaborations = (HashSet) UTIL.clone(rhs_182); 551 } 552 } 553 UmlModel rhs_203 = null; 554 String arg_204 = null; 555 arg_204 = ((XmlAttribute) getAttribute((XmlEntity) vdm_package, new String("name"))).val; 556 HashSet arg_205 = new HashSet(); 557 HashSet var1_209 = new HashSet(); 558 HashSet var1_210 = new HashSet(); 559 var1_210 = (HashSet) classes.clone(); 560 var1_210.addAll(associations); 561 var1_209 = (HashSet) var1_210.clone(); 562 var1_209.addAll(constraints); 563 arg_205 = (HashSet) var1_209.clone(); 564 arg_205.addAll(collaborations); 565 rhs_203 = new UmlModel(arg_204, arg_205); 566 result = (IUmlModel) UTIL.clone(rhs_203); 567 } 568 // ***** VDMTOOLS END Name=VisitXmlDocument#1|XmlDocument 569 570 571 // ***** VDMTOOLS START Name=exstractClass#1|XmlEntity KEEP=NO 572 private IUmlClass exstractClass (final XmlEntity e) throws CGException { 573 574 String name = null; 575 name = ((XmlAttribute) getAttribute((XmlEntity) e, new String("name"))).val; 576 HashSet dBlocks = build_udefBlock((XmlEntity) e, name); 577 Boolean vdm_abstract = null; 578 if (hasAttribute((XmlEntity) e, new String("isAbstract")).booleanValue()) { 579 580 String par_15 = null; 581 par_15 = ((XmlAttribute) getAttribute((XmlEntity) e, new String("isAbstract"))).val; 582 vdm_abstract = (Boolean) StdLib.StringToBool(par_15); 583 } 584 else 585 vdm_abstract = new Boolean(false); 586 Vector supers = null; 587 { 588 589 Vector eg = null; 590 XmlEntityList tmpRec_22 = null; 591 tmpRec_22 = e.entities; 592 eg = tmpRec_22.entities; 593 { 594 595 Vector res_l_24 = new Vector(); 596 HashSet resBind_s_26 = new HashSet(); 597 HashSet riseq_30 = new HashSet(); 598 int max_31 = eg.size(); 599 for (int i_32 = 1; i_32 <= max_31; i_32++) 600 riseq_30.add(new Long(i_32)); 601 resBind_s_26 = riseq_30; 602 Vector bind_l_25 = null; 603 bind_l_25 = UTIL.Sort(resBind_s_26); 604 Long i = null; 605 for (Iterator enm_43 = bind_l_25.iterator(); enm_43.hasNext(); ) { 606 607 Long e_28 = UTIL.NumberToLong(enm_43.next()); 608 i = e_28; 609 Boolean pred_37 = null; 610 XmlEntity par_38 = null; 611 if ((1 <= i.intValue()) && (i.intValue() <= eg.size())) 612 par_38 = (XmlEntity) eg.get(i.intValue() - 1); 613 else 614 UTIL.RunTime("Run-Time Error:Illegal index"); 615 pred_37 = isAttributeType((XmlEntity) par_38, new String("uml:Generalization")); 616 if (pred_37.booleanValue()) { 617 618 IUmlClassNameType reselem_33 = null; 619 XmlEntity par_34 = null; 620 if ((1 <= i.intValue()) && (i.intValue() <= eg.size())) 621 par_34 = (XmlEntity) eg.get(i.intValue() - 1); 622 else 623 UTIL.RunTime("Run-Time Error:Illegal index"); 624 reselem_33 = (IUmlClassNameType) exstractGeneralization((XmlEntity) par_34); 625 res_l_24.add(reselem_33); 626 } 627 } 628 supers = res_l_24; 629 } 630 } 631 UmlVisibilityKind tmpVal_44 = null; 632 tmpVal_44 = (UmlVisibilityKind) new UmlVisibilityKind(UmlVisibilityKindQuotes.IQPUBLIC); 633 IUmlVisibilityKind visibility = null; 634 visibility = (IUmlVisibilityKind) tmpVal_44; 635 Boolean isStatic = new Boolean(false); 636 Boolean active = null; 637 if (hasAttribute((XmlEntity) e, new String("isActive")).booleanValue()) { 638 639 XmlAttribute a = (XmlAttribute) (XmlAttribute) getAttribute((XmlEntity) e, new String("isActive")); 640 if ((!UTIL.equals(a, null))) { 641 642 String par_60 = null; 643 par_60 = a.val; 644 active = (Boolean) StdLib.StringToBool(par_60); 645 } 646 else 647 active = new Boolean(false); 648 } 649 else 650 active = new Boolean(false); 651 IUmlTemplateSignature template = null; 652 String id = null; 653 id = ((XmlAttribute) getAttribute((XmlEntity) e, new String("xmi:id"))).val; 654 IUmlClass cls = (IUmlClass) new UmlClass(name, dBlocks, vdm_abstract, supers, visibility, isStatic, active, template); 655 { 656 657 idToclassesMap.put(id, cls); 658 log.addNewClassInfo(name, id); 659 return (IUmlClass) cls; 660 } 661 } 662 // ***** VDMTOOLS END Name=exstractClass#1|XmlEntity 663 664 665 // ***** VDMTOOLS START Name=exstractGeneralization#1|XmlEntity KEEP=NO 666 private IUmlClassNameType exstractGeneralization (final XmlEntity e) throws CGException { 667 668 String vdm_super = null; 669 vdm_super = ((XmlAttribute) getAttribute((XmlEntity) e, new String("general"))).val; 670 return (IUmlClassNameType) new UmlClassNameType(UTIL.ConvertToString(classesTypeMap.get(vdm_super))); 671 } 672 // ***** VDMTOOLS END Name=exstractGeneralization#1|XmlEntity 673 674 675 // ***** VDMTOOLS START Name=build_udefBlock#2|XmlEntity|String KEEP=NO 676 private HashSet build_udefBlock (final XmlEntity e, final String name) throws CGException { 677 678 Vector eList = null; 679 XmlEntityList tmpRec_5 = null; 680 tmpRec_5 = e.entities; 681 eList = tmpRec_5.entities; 682 HashSet tmpVal_7 = new HashSet(); 683 HashSet res_s_8 = new HashSet(); 684 { 685 686 HashSet e_set_20 = new HashSet(); 687 HashSet riseq_22 = new HashSet(); 688 int max_23 = eList.size(); 689 for (int i_24 = 1; i_24 <= max_23; i_24++) 690 riseq_22.add(new Long(i_24)); 691 e_set_20 = riseq_22; 692 Long i = null; 693 { 694 for (Iterator enm_26 = e_set_20.iterator(); enm_26.hasNext(); ) { 695 696 Long elem_25 = UTIL.NumberToLong(enm_26.next()); 697 i = elem_25; 698 Boolean pred_14 = null; 699 XmlEntity par_15 = null; 700 if ((1 <= i.intValue()) && (i.intValue() <= eList.size())) 701 par_15 = (XmlEntity) eList.get(i.intValue() - 1); 702 else 703 UTIL.RunTime("Run-Time Error:Illegal index"); 704 pred_14 = isAttributeType((XmlEntity) par_15, new String("uml:Property")); 705 if (pred_14.booleanValue()) { 706 707 IUmlProperty res_s_9 = null; 708 XmlEntity par_10 = null; 709 if ((1 <= i.intValue()) && (i.intValue() <= eList.size())) 710 par_10 = (XmlEntity) eList.get(i.intValue() - 1); 711 else 712 UTIL.RunTime("Run-Time Error:Illegal index"); 713 res_s_9 = (IUmlProperty) build_uProperty((XmlEntity) par_10, name); 714 res_s_8.add(res_s_9); 715 } 716 } 717 } 718 } 719 tmpVal_7 = res_s_8; 720 HashSet props = new HashSet(); 721 props = tmpVal_7; 722 HashSet ops = new HashSet(); 723 HashSet res_s_28 = new HashSet(); 724 { 725 726 HashSet e1_set_36 = new HashSet(eList); 727 XmlEntity p = null; 728 { 729 for (Iterator enm_38 = e1_set_36.iterator(); enm_38.hasNext(); ) { 730 731 XmlEntity elem_37 = (XmlEntity) enm_38.next(); 732 p = (XmlEntity) elem_37; 733 if (isAttributeType((XmlEntity) p, new String("uml:Operation")).booleanValue()) { 734 res_s_28.add((IUmlOperation) build_uOperation((XmlEntity) p)); 735 } 736 } 737 } 738 } 739 ops = res_s_28; 740 HashSet rexpr_39 = new HashSet(); 741 HashSet var1_40 = new HashSet(); 742 var1_40 = new HashSet(); 743 var1_40.add(new UmlOwnedProperties(props)); 744 HashSet var2_43 = new HashSet(); 745 var2_43 = new HashSet(); 746 var2_43.add(new UmlOwnedOperations(ops)); 747 rexpr_39 = (HashSet) var1_40.clone(); 748 rexpr_39.addAll(var2_43); 749 return rexpr_39; 750 } 751 // ***** VDMTOOLS END Name=build_udefBlock#2|XmlEntity|String 752 753 754 // ***** VDMTOOLS START Name=build_uProperty#2|XmlEntity|String KEEP=NO 755 private IUmlProperty build_uProperty (final XmlEntity e, final String ownerClass) throws CGException { 756 757 String name = null; 758 name = ((XmlAttribute) getAttribute((XmlEntity) e, new String("name"))).val; 759 Object tmpVal_8 = null; 760 if (hasAttribute((XmlEntity) e, new String("visibility")).booleanValue()) 761 tmpVal_8 = GetVisibility((XmlAttribute) (XmlAttribute) getAttribute((XmlEntity) e, new String("visibility"))); 762 else 763 tmpVal_8 = new UmlVisibilityKind(UmlVisibilityKindQuotes.IQPRIVATE); 764 IUmlVisibilityKind visibility = null; 765 visibility = (IUmlVisibilityKind) tmpVal_8; 766 IUmlMultiplicityElement multiplicity = (IUmlMultiplicityElement) (IUmlMultiplicityElement) getMultiplicity((XmlEntity) e); 767 IUmlType tmpVal_19 = null; 768 tmpVal_19 = (IUmlType) (IUmlType) lookUpType((XmlEntity) e); 769 IUmlType type = null; 770 type = (IUmlType) tmpVal_19; 771 Boolean isReadOnly = null; 772 if (hasAttribute((XmlEntity) e, new String("isReadOnly")).booleanValue()) { 773 774 String par_26 = null; 775 par_26 = ((XmlAttribute) getAttribute((XmlEntity) e, new String("isReadOnly"))).val; 776 isReadOnly = (Boolean) StdLib.StringToBool(par_26); 777 } 778 else 779 isReadOnly = new Boolean(false); 780 IUmlValueSpecification vdm_default = null; 781 { 782 783 HashSet dValue = new HashSet(); 784 HashSet res_s_33 = new HashSet(); 785 { 786 787 Vector e_set_40 = null; 788 XmlEntityList tmpRec_41 = null; 789 tmpRec_41 = e.entities; 790 e_set_40 = tmpRec_41.entities; 791 XmlEntity el = null; 792 { 793 for (Iterator enm_44 = e_set_40.iterator(); enm_44.hasNext(); ) { 794 795 XmlEntity elem_43 = (XmlEntity) enm_44.next(); 796 el = (XmlEntity) elem_43; 797 Boolean pred_35 = null; 798 String var1_36 = null; 799 var1_36 = el.name; 800 pred_35 = new Boolean(UTIL.equals(var1_36, new String("defaultValue"))); 801 if (pred_35.booleanValue()) { 802 res_s_33.add(el); 803 } 804 } 805 } 806 } 807 dValue = res_s_33; 808 if (((new Long(dValue.size()).intValue()) > (new Long(0).intValue()))) { 809 810 XmlEntity par_50 = null; 811 { 812 813 HashSet tmpSet_51 = new HashSet(); 814 tmpSet_51 = dValue; 815 XmlEntity d = null; 816 boolean succ_53 = false; 817 for (Iterator enm_55 = tmpSet_51.iterator(); enm_55.hasNext() && !succ_53; ) { 818 819 XmlEntity tmpElem_54 = (XmlEntity) enm_55.next(); 820 succ_53 = true; 821 d = (XmlEntity) tmpElem_54; 822 } 823 if (!succ_53) 824 UTIL.RunTime("Run-Time Error:The binding environment was empty"); 825 par_50 = (XmlEntity) d; 826 } 827 vdm_default = (IUmlValueSpecification) getDefaultValue((XmlEntity) par_50); 828 } 829 else 830 vdm_default = null; 831 } 832 Boolean isComposite = new Boolean(false); 833 Boolean isDerived = new Boolean(false); 834 Boolean isStatic = new Boolean(false); 835 IUmlType qualifier = null; 836 return (IUmlProperty) new UmlProperty(name, visibility, multiplicity, type, isReadOnly, vdm_default, isComposite, isDerived, isStatic, ownerClass, qualifier); 837 } 838 // ***** VDMTOOLS END Name=build_uProperty#2|XmlEntity|String 839 840 841 // ***** VDMTOOLS START Name=getDefaultValue#1|XmlEntity KEEP=NO 842 private IUmlValueSpecification getDefaultValue (final XmlEntity e) throws CGException { 843 844 String val = null; 845 val = ((XmlAttribute) getAttribute((XmlEntity) e, new String("value"))).val; 846 String typ = null; 847 typ = ((XmlAttribute) getAttribute((XmlEntity) e, new String("xmi:type"))).val; 848 Object rexpr_11 = null; 849 boolean succ_12 = true; 850 { 851 852 succ_12 = true; 853 if (!UTIL.equals(typ, new String("uml:LiteralString"))) 854 succ_12 = false; 855 if (succ_12) 856 rexpr_11 = new UmlLiteralString(val); 857 } 858 if (!succ_12) { 859 860 succ_12 = true; 861 if (!UTIL.equals(typ, new String("uml:LiteralInteger"))) 862 succ_12 = false; 863 if (succ_12) { 864 865 Long arg_18 = null; 866 arg_18 = UTIL.NumberToLong(StdLib.StringToInt(val)); 867 rexpr_11 = new UmlLiteralInteger(arg_18); 868 } 869 } 870 if (!succ_12) 871 rexpr_11 = null; 872 return (IUmlValueSpecification) rexpr_11; 873 } 874 // ***** VDMTOOLS END Name=getDefaultValue#1|XmlEntity 875 876 877 // ***** VDMTOOLS START Name=getMultiplicity#1|XmlEntity KEEP=NO 878 private IUmlMultiplicityElement getMultiplicity (final XmlEntity e) throws CGException { 879 880 Vector eList = null; 881 XmlEntityList tmpRec_4 = null; 882 tmpRec_4 = e.entities; 883 eList = tmpRec_4.entities; 884 HashSet lowerSet = new HashSet(); 885 HashSet res_s_7 = new HashSet(); 886 { 887 888 HashSet e1_set_22 = new HashSet(eList); 889 XmlEntity el = null; 890 { 891 for (Iterator enm_24 = e1_set_22.iterator(); enm_24.hasNext(); ) { 892 893 XmlEntity elem_23 = (XmlEntity) enm_24.next(); 894 el = (XmlEntity) elem_23; 895 Boolean pred_12 = null; 896 Boolean var1_13 = null; 897 String var1_14 = null; 898 var1_14 = el.name; 899 var1_13 = new Boolean(UTIL.equals(var1_14, new String("lowerValue"))); 900 { 901 if ((pred_12 = var1_13).booleanValue()) 902 pred_12 = hasAttribute((XmlEntity) e, new String("value")); 903 } 904 if (pred_12.booleanValue()) { 905 906 String res_s_8 = null; 907 res_s_8 = ((XmlAttribute) getAttribute((XmlEntity) el, new String("value"))).val; 908 res_s_7.add(res_s_8); 909 } 910 } 911 } 912 } 913 lowerSet = res_s_7; 914 HashSet upperSet = new HashSet(); 915 HashSet res_s_26 = new HashSet(); 916 { 917 918 HashSet e1_set_41 = new HashSet(eList); 919 XmlEntity el = null; 920 { 921 for (Iterator enm_43 = e1_set_41.iterator(); enm_43.hasNext(); ) { 922 923 XmlEntity elem_42 = (XmlEntity) enm_43.next(); 924 el = (XmlEntity) elem_42; 925 Boolean pred_31 = null; 926 Boolean var1_32 = null; 927 String var1_33 = null; 928 var1_33 = el.name; 929 var1_32 = new Boolean(UTIL.equals(var1_33, new String("upperValue"))); 930 { 931 if ((pred_31 = var1_32).booleanValue()) 932 pred_31 = hasAttribute((XmlEntity) e, new String("value")); 933 } 934 if (pred_31.booleanValue()) { 935 936 String res_s_27 = null; 937 res_s_27 = ((XmlAttribute) getAttribute((XmlEntity) el, new String("value"))).val; 938 res_s_26.add(res_s_27); 939 } 940 } 941 } 942 } 943 upperSet = res_s_26; 944 Boolean cond_44 = null; 945 { 946 if ((cond_44 = new Boolean(new Long(upperSet.size()).intValue() == new Long(0).intValue())).booleanValue()) 947 cond_44 = new Boolean(new Long(lowerSet.size()).intValue() == new Long(0).intValue()); 948 } 949 if (cond_44.booleanValue()) 950 return null; 951 else { 952 953 Long lower = null; 954 if ((new Long(lowerSet.size()).intValue() == new Long(0).intValue())) 955 lower = new Long(0); 956 else { 957 958 HashSet tmpSet_60 = new HashSet(); 959 tmpSet_60 = lowerSet; 960 String p = null; 961 boolean succ_62 = false; 962 for (Iterator enm_64 = tmpSet_60.iterator(); enm_64.hasNext() && !succ_62; ) { 963 964 String tmpElem_63 = UTIL.ConvertToString(enm_64.next()); 965 succ_62 = true; 966 p = tmpElem_63; 967 } 968 if (!succ_62) 969 UTIL.RunTime("Run-Time Error:The binding environment was empty"); 970 lower = UTIL.NumberToLong(StdLib.StringToInt(p)); 971 } 972 Long upper = null; 973 if ((new Long(upperSet.size()).intValue() == new Long(0).intValue())) 974 upper = null; 975 else { 976 977 HashSet tmpSet_72 = new HashSet(); 978 tmpSet_72 = upperSet; 979 String p = null; 980 boolean succ_74 = false; 981 for (Iterator enm_76 = tmpSet_72.iterator(); enm_76.hasNext() && !succ_74; ) { 982 983 String tmpElem_75 = UTIL.ConvertToString(enm_76.next()); 984 succ_74 = true; 985 p = tmpElem_75; 986 } 987 if (!succ_74) 988 UTIL.RunTime("Run-Time Error:The binding environment was empty"); 989 upper = UTIL.NumberToLong(StdLib.StringToInt(p)); 990 } 991 return (IUmlMultiplicityElement) new UmlMultiplicityElement(new Boolean(false), new Boolean(false), lower, upper); 992 } 993 } 994 // ***** VDMTOOLS END Name=getMultiplicity#1|XmlEntity 995 996 997 // ***** VDMTOOLS START Name=build_uOperation#1|XmlEntity KEEP=NO 998 private IUmlOperation build_uOperation (final XmlEntity e) throws CGException { 999 1000 String tmpVal_3 = null; 1001 tmpVal_3 = ((XmlAttribute) getAttribute((XmlEntity) e, new String("name"))).val; 1002 String name = null; 1003 name = tmpVal_3; 1004 IUmlVisibilityKind tmpVal_7 = null; 1005 tmpVal_7 = (IUmlVisibilityKind) (IUmlVisibilityKind) GetVisibility((XmlAttribute) (XmlAttribute) getAttribute((XmlEntity) e, new String("visibility"))); 1006 IUmlVisibilityKind visibility = null; 1007 visibility = (IUmlVisibilityKind) tmpVal_7; 1008 IUmlMultiplicityElement multiplicity = (IUmlMultiplicityElement) new UmlMultiplicityElement(new Boolean(false), new Boolean(false), new Long(0), new Long(0)); 1009 Boolean isQuery = null; 1010 if (hasAttribute((XmlEntity) e, new String("isQuery")).booleanValue()) { 1011 1012 String par_21 = null; 1013 par_21 = ((XmlAttribute) getAttribute((XmlEntity) e, new String("isQuery"))).val; 1014 isQuery = (Boolean) StdLib.StringToBool(par_21); 1015 } 1016 else 1017 isQuery = new Boolean(false); 1018 Object tmpVal_25 = null; 1019 tmpVal_25 = null; 1020 IUmlType type = null; 1021 type = (IUmlType) tmpVal_25; 1022 Boolean isStatic = null; 1023 if (hasAttribute((XmlEntity) e, new String("isStatic")).booleanValue()) { 1024 1025 String par_31 = null; 1026 par_31 = ((XmlAttribute) getAttribute((XmlEntity) e, new String("isStatic"))).val; 1027 isStatic = (Boolean) StdLib.StringToBool(par_31); 1028 } 1029 else 1030 isStatic = new Boolean(false); 1031 String id = null; 1032 id = ((XmlAttribute) getAttribute((XmlEntity) e, new String("xmi:id"))).val; 1033 Vector params = CreateOperstionParameters((XmlEntity) e); 1034 UmlParameters parameters = null; 1035 if ((UTIL.equals(params, null))) 1036 parameters = null; 1037 else 1038 parameters = (UmlParameters) new UmlParameters(params); 1039 IUmlOperation operation = (IUmlOperation) new UmlOperation(name, visibility, multiplicity, isQuery, type, isStatic, parameters); 1040 { 1041 1042 idToOperationMap.put(id, operation); 1043 return (IUmlOperation) operation; 1044 } 1045 } 1046 // ***** VDMTOOLS END Name=build_uOperation#1|XmlEntity 1047 1048 1049 // ***** VDMTOOLS START Name=CreateOperstionParameters#1|XmlEntity KEEP=NO 1050 protected Vector CreateOperstionParameters (final XmlEntity e) throws CGException { 1051 1052 Vector tmpVal_3 = null; 1053 XmlEntityList tmpRec_4 = null; 1054 tmpRec_4 = e.entities; 1055 tmpVal_3 = tmpRec_4.entities; 1056 Vector elist = null; 1057 elist = tmpVal_3; 1058 Vector tmpVal_6 = null; 1059 { 1060 1061 Vector res_l_7 = new Vector(); 1062 HashSet resBind_s_9 = new HashSet(); 1063 HashSet riseq_13 = new HashSet(); 1064 int max_14 = elist.size(); 1065 for (int i_15 = 1; i_15 <= max_14; i_15++) 1066 riseq_13.add(new Long(i_15)); 1067 resBind_s_9 = riseq_13; 1068 Vector bind_l_8 = null; 1069 bind_l_8 = UTIL.Sort(resBind_s_9); 1070 Long i = null; 1071 for (Iterator enm_47 = bind_l_8.iterator(); enm_47.hasNext(); ) { 1072 1073 Long e_11 = UTIL.NumberToLong(enm_47.next()); 1074 i = e_11; 1075 Boolean pred_40 = null; 1076 String var1_41 = null; 1077 XmlEntity tmpRec_42 = null; 1078 if ((1 <= i.intValue()) && (i.intValue() <= elist.size())) 1079 tmpRec_42 = (XmlEntity) elist.get(i.intValue() - 1); 1080 else 1081 UTIL.RunTime("Run-Time Error:Illegal index"); 1082 var1_41 = tmpRec_42.name; 1083 pred_40 = new Boolean(UTIL.equals(var1_41, new String("ownedParameter"))); 1084 if (pred_40.booleanValue()) { 1085 1086 UmlParameter reselem_16 = null; 1087 String arg_17 = null; 1088 XmlAttribute tmpRec_22 = null; 1089 XmlEntity par_23 = null; 1090 if ((1 <= i.intValue()) && (i.intValue() <= elist.size())) 1091 par_23 = (XmlEntity) elist.get(i.intValue() - 1); 1092 else 1093 UTIL.RunTime("Run-Time Error:Illegal index"); 1094 tmpRec_22 = (XmlAttribute) getAttribute((XmlEntity) par_23, new String("name")); 1095 arg_17 = tmpRec_22.val; 1096 IUmlType arg_18 = null; 1097 XmlEntity par_27 = null; 1098 if ((1 <= i.intValue()) && (i.intValue() <= elist.size())) 1099 par_27 = (XmlEntity) elist.get(i.intValue() - 1); 1100 else 1101 UTIL.RunTime("Run-Time Error:Illegal index"); 1102 arg_18 = (IUmlType) lookUpType((XmlEntity) par_27); 1103 IUmlParameterDirectionKind arg_21 = null; 1104 String par_34 = null; 1105 XmlAttribute tmpRec_35 = null; 1106 XmlEntity par_36 = null; 1107 if ((1 <= i.intValue()) && (i.intValue() <= elist.size())) 1108 par_36 = (XmlEntity) elist.get(i.intValue() - 1); 1109 else 1110 UTIL.RunTime("Run-Time Error:Illegal index"); 1111 tmpRec_35 = (XmlAttribute) getAttribute((XmlEntity) par_36, new String("direction")); 1112 par_34 = tmpRec_35.val; 1113 arg_21 = (IUmlParameterDirectionKind) ConvertParameterDirectionKind(par_34); 1114 reselem_16 = new UmlParameter(arg_17, arg_18, new UmlMultiplicityElement(new Boolean(false), new Boolean(false), new Long(1), new Long(1)), new String(""), arg_21); 1115 res_l_7.add(reselem_16); 1116 } 1117 } 1118 tmpVal_6 = res_l_7; 1119 } 1120 Vector parms = null; 1121 parms = tmpVal_6; 1122 Vector rexpr_48 = null; 1123 if ((new Long(parms.size()).intValue() == new Long(0).intValue())) 1124 rexpr_48 = null; 1125 else 1126 rexpr_48 = parms; 1127 return rexpr_48; 1128 } 1129 // ***** VDMTOOLS END Name=CreateOperstionParameters#1|XmlEntity 1130 1131 1132 // ***** VDMTOOLS START Name=ConvertParameterDirectionKind#1|String KEEP=NO 1133 private IUmlParameterDirectionKind ConvertParameterDirectionKind (final String val) throws CGException { 1134 1135 UmlParameterDirectionKind varRes_2 = null; 1136 boolean succ_3 = true; 1137 { 1138 1139 succ_3 = true; 1140 if (!UTIL.equals(val, new String("in"))) 1141 succ_3 = false; 1142 if (succ_3) 1143 varRes_2 = (UmlParameterDirectionKind) new UmlParameterDirectionKind(UmlParameterDirectionKindQuotes.IQIN); 1144 } 1145 if (!succ_3) { 1146 1147 succ_3 = true; 1148 if (!UTIL.equals(val, new String("out"))) 1149 succ_3 = false; 1150 if (succ_3) 1151 varRes_2 = (UmlParameterDirectionKind) new UmlParameterDirectionKind(UmlParameterDirectionKindQuotes.IQOUT); 1152 } 1153 if (!succ_3) { 1154 1155 succ_3 = true; 1156 if (!UTIL.equals(val, new String("return"))) 1157 succ_3 = false; 1158 if (succ_3) 1159 varRes_2 = (UmlParameterDirectionKind) new UmlParameterDirectionKind(UmlParameterDirectionKindQuotes.IQRETURN); 1160 } 1161 if (!succ_3) { 1162 1163 succ_3 = true; 1164 if (!UTIL.equals(val, new String("inout"))) 1165 succ_3 = false; 1166 if (succ_3) 1167 varRes_2 = (UmlParameterDirectionKind) new UmlParameterDirectionKind(UmlParameterDirectionKindQuotes.IQINOUT); 1168 } 1169 if (!succ_3) 1170 UTIL.RunTime("Run-Time Error:No \'others\' branch in CasesExpr"); 1171 return (IUmlParameterDirectionKind) varRes_2; 1172 } 1173 // ***** VDMTOOLS END Name=ConvertParameterDirectionKind#1|String 1174 1175 1176 // ***** VDMTOOLS START Name=build_uConstraint#1|XmlEntity KEEP=NO 1177 private IUmlConstraint build_uConstraint (final XmlEntity e) throws CGException { 1178 1179 UmlConstraint varRes_2 = null; 1180 { 1181 1182 Vector elist = null; 1183 XmlEntityList tmpRec_5 = null; 1184 tmpRec_5 = e.entities; 1185 elist = tmpRec_5.entities; 1186 HashSet ids = new HashSet(); 1187 HashSet res_s_8 = new HashSet(); 1188 { 1189 1190 HashSet e1_set_18 = new HashSet(elist); 1191 XmlEntity p = null; 1192 { 1193 for (Iterator enm_20 = e1_set_18.iterator(); enm_20.hasNext(); ) { 1194 1195 XmlEntity elem_19 = (XmlEntity) enm_20.next(); 1196 p = (XmlEntity) elem_19; 1197 if (hasAttribute((XmlEntity) p, new String("xmi:idref")).booleanValue()) { 1198 1199 String res_s_9 = null; 1200 res_s_9 = ((XmlAttribute) getAttribute((XmlEntity) p, new String("xmi:idref"))).val; 1201 res_s_8.add(res_s_9); 1202 } 1203 } 1204 } 1205 } 1206 ids = res_s_8; 1207 String specification = null; 1208 Vector unArg_22 = null; 1209 HashSet par_23 = new HashSet(); 1210 HashSet res_s_24 = new HashSet(); 1211 { 1212 1213 HashSet e1_set_34 = new HashSet(elist); 1214 XmlEntity p = null; 1215 { 1216 for (Iterator enm_36 = e1_set_34.iterator(); enm_36.hasNext(); ) { 1217 1218 XmlEntity elem_35 = (XmlEntity) enm_36.next(); 1219 p = (XmlEntity) elem_35; 1220 Boolean pred_28 = null; 1221 String var1_29 = null; 1222 var1_29 = p.name; 1223 pred_28 = new Boolean(UTIL.equals(var1_29, new String("body"))); 1224 if (pred_28.booleanValue()) { 1225 1226 String res_s_25 = null; 1227 XmlData tmpRec_26 = null; 1228 tmpRec_26 = p.data; 1229 res_s_25 = tmpRec_26.data; 1230 res_s_24.add(res_s_25); 1231 } 1232 } 1233 } 1234 } 1235 par_23 = res_s_24; 1236 unArg_22 = (Vector) UTIL.ConvertToList(Util.SetToSeq(par_23)); 1237 specification = UTIL.ConvertToString(unArg_22.get(0)); 1238 varRes_2 = (UmlConstraint) new UmlConstraint(ids, new UmlLiteralString(specification)); 1239 } 1240 return (IUmlConstraint) varRes_2; 1241 } 1242 // ***** VDMTOOLS END Name=build_uConstraint#1|XmlEntity 1243 1244 1245 // ***** VDMTOOLS START Name=build_uAssociation#1|XmlEntity KEEP=NO 1246 private IUmlAssociation build_uAssociation (final XmlEntity e) throws CGException { 1247 1248 Vector tmpVal_3 = null; 1249 XmlEntityList tmpRec_4 = null; 1250 tmpRec_4 = e.entities; 1251 tmpVal_3 = tmpRec_4.entities; 1252 Vector elist = null; 1253 elist = tmpVal_3; 1254 HashSet tmpVal_6 = new HashSet(); 1255 HashSet res_s_7 = new HashSet(); 1256 { 1257 1258 HashSet e_set_17 = new HashSet(); 1259 HashSet riseq_19 = new HashSet(); 1260 int max_20 = elist.size(); 1261 for (int i_21 = 1; i_21 <= max_20; i_21++) 1262 riseq_19.add(new Long(i_21)); 1263 e_set_17 = riseq_19; 1264 Long i = null; 1265 { 1266 for (Iterator enm_23 = e_set_17.iterator(); enm_23.hasNext(); ) { 1267 1268 Long elem_22 = UTIL.NumberToLong(enm_23.next()); 1269 i = elem_22; 1270 Boolean pred_11 = null; 1271 XmlEntity par_12 = null; 1272 if ((1 <= i.intValue()) && (i.intValue() <= elist.size())) 1273 par_12 = (XmlEntity) elist.get(i.intValue() - 1); 1274 else 1275 UTIL.RunTime("Run-Time Error:Illegal index"); 1276 pred_11 = isAttributeType((XmlEntity) par_12, new String("uml:Property")); 1277 if (pred_11.booleanValue()) { 1278 1279 XmlEntity res_s_8 = null; 1280 if ((1 <= i.intValue()) && (i.intValue() <= elist.size())) 1281 res_s_8 = (XmlEntity) elist.get(i.intValue() - 1); 1282 else 1283 UTIL.RunTime("Run-Time Error:Illegal index"); 1284 res_s_7.add(res_s_8); 1285 } 1286 } 1287 } 1288 } 1289 tmpVal_6 = res_s_7; 1290 HashSet props = new HashSet(); 1291 props = tmpVal_6; 1292 HashSet ownedNavivableEnds = new HashSet(); 1293 HashSet res_s_25 = new HashSet(); 1294 { 1295 1296 XmlEntity p = null; 1297 { 1298 for (Iterator enm_36 = props.iterator(); enm_36.hasNext(); ) { 1299 1300 XmlEntity elem_35 = (XmlEntity) enm_36.next(); 1301 p = (XmlEntity) elem_35; 1302 if (hasAttributeValue((XmlEntity) p, new String("name"), new String("")).booleanValue()) { 1303 res_s_25.add((IUmlProperty) build_uProperty((XmlEntity) p, new String(""))); 1304 } 1305 } 1306 } 1307 } 1308 ownedNavivableEnds = res_s_25; 1309 Vector one = null; 1310 one = (Vector) UTIL.ConvertToList(Util.SetToSeq(ownedNavivableEnds)); 1311 IUmlType ownerClassType = null; 1312 Vector unArg_40 = null; 1313 { 1314 1315 Vector res_l_41 = new Vector(); 1316 HashSet resBind_s_43 = new HashSet(); 1317 HashSet riseq_47 = new HashSet(); 1318 int max_48 = one.size(); 1319 for (int i_49 = 1; i_49 <= max_48; i_49++) 1320 riseq_47.add(new Long(i_49)); 1321 resBind_s_43 = riseq_47; 1322 Vector bind_l_42 = null; 1323 bind_l_42 = UTIL.Sort(resBind_s_43); 1324 Long i = null; 1325 for (Iterator enm_55 = bind_l_42.iterator(); enm_55.hasNext(); ) { 1326 1327 Long e_45 = UTIL.NumberToLong(enm_55.next()); 1328 i = e_45; 1329 IUmlType reselem_50 = null; 1330 IUmlProperty obj_51 = null; 1331 if ((1 <= i.intValue()) && (i.intValue() <= one.size())) 1332 obj_51 = (IUmlProperty) one.get(i.intValue() - 1); 1333 else 1334 UTIL.RunTime("Run-Time Error:Illegal index"); 1335 reselem_50 = (IUmlType) obj_51.getType(); 1336 res_l_41.add(reselem_50); 1337 } 1338 unArg_40 = res_l_41; 1339 } 1340 ownerClassType = (IUmlType) unArg_40.get(0); 1341 String tmpVal_56 = null; 1342 { 1343 1344 IUmlClassNameType ct = (IUmlClassNameType) ownerClassType; 1345 tmpVal_56 = ct.getName(); 1346 } 1347 String ownerClass = null; 1348 ownerClass = tmpVal_56; 1349 HashSet ownedEnds = new HashSet(); 1350 HashSet res_s_60 = new HashSet(); 1351 { 1352 1353 XmlEntity p = null; 1354 { 1355 for (Iterator enm_74 = props.iterator(); enm_74.hasNext(); ) { 1356 1357 XmlEntity elem_73 = (XmlEntity) enm_74.next(); 1358 p = (XmlEntity) elem_73; 1359 Boolean pred_64 = null; 1360 Long var1_65 = null; 1361 String unArg_66 = null; 1362 unArg_66 = ((XmlAttribute) getAttribute((XmlEntity) p, new String("name"))).val; 1363 var1_65 = new Long(unArg_66.length()); 1364 pred_64 = new Boolean((var1_65.intValue()) > (new Long(0).intValue())); 1365 if (pred_64.booleanValue()) { 1366 res_s_60.add((IUmlProperty) build_uProperty((XmlEntity) p, ownerClass)); 1367 } 1368 } 1369 } 1370 } 1371 ownedEnds = res_s_60; 1372 String tmpVal_75 = null; 1373 tmpVal_75 = ((XmlAttribute) getAttribute((XmlEntity) e, new String("name"))).val; 1374 String name = null; 1375 name = tmpVal_75; 1376 String id = null; 1377 id = ((XmlAttribute) getAttribute((XmlEntity) e, new String("xmi:id"))).val; 1378 return (IUmlAssociation) new UmlAssociation(ownedEnds, ownedNavivableEnds, name, id); 1379 } 1380 // ***** VDMTOOLS END Name=build_uAssociation#1|XmlEntity 1381 1382 1383 // ***** VDMTOOLS START Name=lookUpType#1|XmlEntity KEEP=NO 1384 private IUmlType lookUpType (final XmlEntity e) throws CGException { 1385 1386 Vector elist = null; 1387 XmlEntityList tmpRec_4 = null; 1388 tmpRec_4 = e.entities; 1389 elist = tmpRec_4.entities; 1390 HashSet typeOption1 = new HashSet(); 1391 if (hasAttribute((XmlEntity) e, new String("type")).booleanValue()) { 1392 1393 String enum_set_32 = null; 1394 enum_set_32 = ((XmlAttribute) getAttribute((XmlEntity) e, new String("type"))).val; 1395 typeOption1 = new HashSet(); 1396 typeOption1.add(enum_set_32); 1397 } 1398 else { 1399 1400 HashSet res_s_11 = new HashSet(); 1401 { 1402 1403 HashSet e_set_25 = new HashSet(); 1404 HashSet riseq_27 = new HashSet(); 1405 int max_28 = elist.size(); 1406 for (int i_29 = 1; i_29 <= max_28; i_29++) 1407 riseq_27.add(new Long(i_29)); 1408 e_set_25 = riseq_27; 1409 Long i = null; 1410 { 1411 for (Iterator enm_31 = e_set_25.iterator(); enm_31.hasNext(); ) { 1412 1413 Long elem_30 = UTIL.NumberToLong(enm_31.next()); 1414 i = elem_30; 1415 Boolean pred_18 = null; 1416 String var1_19 = null; 1417 XmlEntity tmpRec_20 = null; 1418 if ((1 <= i.intValue()) && (i.intValue() <= elist.size())) 1419 tmpRec_20 = (XmlEntity) elist.get(i.intValue() - 1); 1420 else 1421 UTIL.RunTime("Run-Time Error:Illegal index"); 1422 var1_19 = tmpRec_20.name; 1423 pred_18 = new Boolean(UTIL.equals(var1_19, new String("type"))); 1424 if (pred_18.booleanValue()) { 1425 1426 String res_s_12 = null; 1427 XmlAttribute tmpRec_13 = null; 1428 XmlEntity par_14 = null; 1429 if ((1 <= i.intValue()) && (i.intValue() <= elist.size())) 1430 par_14 = (XmlEntity) elist.get(i.intValue() - 1); 1431 else 1432 UTIL.RunTime("Run-Time Error:Illegal index"); 1433 tmpRec_13 = (XmlAttribute) getAttribute((XmlEntity) par_14, new String("xmi:idref")); 1434 res_s_12 = tmpRec_13.val; 1435 res_s_11.add(res_s_12); 1436 } 1437 } 1438 } 1439 } 1440 typeOption1 = res_s_11; 1441 } 1442 { 1443 1444 HashSet tmpSet_36 = new HashSet(); 1445 tmpSet_36 = typeOption1; 1446 String id = null; 1447 boolean succ_38 = false; 1448 for (Iterator enm_40 = tmpSet_36.iterator(); enm_40.hasNext() && !succ_38; ) { 1449 1450 String tmpElem_39 = UTIL.ConvertToString(enm_40.next()); 1451 succ_38 = true; 1452 id = tmpElem_39; 1453 } 1454 if (!succ_38) 1455 UTIL.RunTime("Run-Time Error:The binding environment was empty"); 1456 { 1457 1458 String typeName = null; 1459 Boolean cond_44 = null; 1460 cond_44 = new Boolean(classesTypeMap.containsKey(id)); 1461 if (cond_44.booleanValue()) 1462 typeName = UTIL.ConvertToString(classesTypeMap.get(id)); 1463 else 1464 typeName = null; 1465 boolean succ_49 = true; 1466 { 1467 1468 succ_49 = true; 1469 if (!UTIL.equals(typeName, null)) 1470 succ_49 = false; 1471 if (succ_49) 1472 return (IUmlType) new UmlIntegerType(); 1473 else { 1474 1475 succ_49 = true; 1476 if (!UTIL.equals(typeName, new String("String"))) 1477 succ_49 = false; 1478 if (succ_49) 1479 return (IUmlType) new UmlStringType(); 1480 else { 1481 1482 succ_49 = true; 1483 if (!UTIL.equals(typeName, new String("int"))) 1484 succ_49 = false; 1485 if (succ_49) 1486 return (IUmlType) new UmlIntegerType(); 1487 else { 1488 1489 succ_49 = true; 1490 if (!UTIL.equals(typeName, new String("bool"))) 1491 succ_49 = false; 1492 if (succ_49) 1493 return (IUmlType) new UmlBoolType(); 1494 else { 1495 1496 succ_49 = true; 1497 if (!UTIL.equals(typeName, new String("char"))) 1498 succ_49 = false; 1499 if (succ_49) 1500 return (IUmlType) new UmlCharType(); 1501 else { 1502 1503 succ_49 = true; 1504 if (!UTIL.equals(typeName, new String("unlimitedNatural"))) 1505 succ_49 = false; 1506 if (succ_49) 1507 return (IUmlType) new UmlUnlimitedNatural(); 1508 else 1509 return (IUmlType) new UmlClassNameType(typeName); 1510 } 1511 } 1512 } 1513 } 1514 } 1515 } 1516 } 1517 } 1518 } 1519 // ***** VDMTOOLS END Name=lookUpType#1|XmlEntity 1520 1521 1522 // ***** VDMTOOLS START Name=VisitXmlEntity#1|XmlEntity KEEP=NO 1523 public void VisitXmlEntity (final XmlEntity e) throws CGException { 1524 1525 HashSet rhs_2 = new HashSet(); 1526 HashSet var2_4 = new HashSet(); 1527 HashSet res_s_5 = new HashSet(); 1528 { 1529 1530 HashSet e_set_19 = new HashSet(); 1531 e_set_19 = new HashSet(); 1532 e_set_19.add(e); 1533 XmlEntity entity = null; 1534 { 1535 for (Iterator enm_22 = e_set_19.iterator(); enm_22.hasNext(); ) { 1536 1537 XmlEntity elem_21 = (XmlEntity) enm_22.next(); 1538 entity = (XmlEntity) elem_21; 1539 Boolean pred_8 = null; 1540 { 1541 if ((pred_8 = isAttributeType((XmlEntity) entity, new String("uml:Class"))).booleanValue()) { 1542 1543 Boolean var2_12 = null; 1544 String var1_13 = null; 1545 var1_13 = ((XmlAttribute) getAttribute((XmlEntity) entity, new String("name"))).val; 1546 var2_12 = new Boolean(!primiticeTypes.contains(var1_13)); 1547 pred_8 = var2_12; 1548 } 1549 } 1550 if (pred_8.booleanValue()) { 1551 res_s_5.add((IUmlClass) exstractClass((XmlEntity) entity)); 1552 } 1553 } 1554 } 1555 } 1556 var2_4 = res_s_5; 1557 rhs_2 = (HashSet) classes.clone(); 1558 rhs_2.addAll(var2_4); 1559 classes = (HashSet) UTIL.clone(rhs_2); 1560 HashSet rhs_23 = new HashSet(); 1561 HashSet var2_25 = new HashSet(); 1562 HashSet res_s_26 = new HashSet(); 1563 { 1564 1565 HashSet e_set_33 = new HashSet(); 1566 e_set_33 = new HashSet(); 1567 e_set_33.add(e); 1568 XmlEntity entity = null; 1569 { 1570 for (Iterator enm_36 = e_set_33.iterator(); enm_36.hasNext(); ) { 1571 1572 XmlEntity elem_35 = (XmlEntity) enm_36.next(); 1573 entity = (XmlEntity) elem_35; 1574 if (isAttributeType((XmlEntity) entity, new String("uml:Association")).booleanValue()) { 1575 res_s_26.add((IUmlAssociation) build_uAssociation((XmlEntity) entity)); 1576 } 1577 } 1578 } 1579 } 1580 var2_25 = res_s_26; 1581 rhs_23 = (HashSet) associations.clone(); 1582 rhs_23.addAll(var2_25); 1583 associations = (HashSet) UTIL.clone(rhs_23); 1584 } 1585 // ***** VDMTOOLS END Name=VisitXmlEntity#1|XmlEntity 1586 1587 1588 // ***** VDMTOOLS START Name=hasAttribute#2|XmlEntity|String KEEP=NO 1589 private Boolean hasAttribute (final XmlEntity e, final String name) throws CGException { 1590 1591 Boolean varRes_3 = null; 1592 { 1593 1594 Vector tmpVal_5 = null; 1595 XmlAttributeList tmpRec_6 = null; 1596 tmpRec_6 = e.attributes; 1597 tmpVal_5 = tmpRec_6.attributes; 1598 Vector list = null; 1599 list = tmpVal_5; 1600 boolean tmpQuant_8 = false; 1601 { 1602 1603 HashSet e_set_16 = new HashSet(); 1604 HashSet riseq_18 = new HashSet(); 1605 int max_19 = list.size(); 1606 for (int i_20 = 1; i_20 <= max_19; i_20++) 1607 riseq_18.add(new Long(i_20)); 1608 e_set_16 = riseq_18; 1609 Long i = null; 1610 { 1611 for (Iterator enm_22 = e_set_16.iterator(); enm_22.hasNext() && !tmpQuant_8; ) { 1612 1613 Long elem_21 = UTIL.NumberToLong(enm_22.next()); 1614 i = elem_21; 1615 Boolean pred_9 = null; 1616 String var1_10 = null; 1617 XmlAttribute tmpRec_11 = null; 1618 if ((1 <= i.intValue()) && (i.intValue() <= list.size())) 1619 tmpRec_11 = (XmlAttribute) list.get(i.intValue() - 1); 1620 else 1621 UTIL.RunTime("Run-Time Error:Illegal index"); 1622 var1_10 = tmpRec_11.name; 1623 pred_9 = new Boolean(UTIL.equals(var1_10, name)); 1624 if (pred_9.booleanValue()) 1625 tmpQuant_8 = true; 1626 } 1627 } 1628 } 1629 varRes_3 = new Boolean(tmpQuant_8); 1630 } 1631 return varRes_3; 1632 } 1633 // ***** VDMTOOLS END Name=hasAttribute#2|XmlEntity|String 1634 1635 1636 // ***** VDMTOOLS START Name=hasAttributeValue#3|XmlEntity|String|String KEEP=NO 1637 private Boolean hasAttributeValue (final XmlEntity e, final String name, final String val) throws CGException { 1638 1639 Boolean varRes_4 = null; 1640 { 1641 1642 Vector tmpVal_6 = null; 1643 XmlAttributeList tmpRec_7 = null; 1644 tmpRec_7 = e.attributes; 1645 tmpVal_6 = tmpRec_7.attributes; 1646 Vector list = null; 1647 list = tmpVal_6; 1648 boolean tmpQuant_9 = false; 1649 { 1650 1651 HashSet e_set_24 = new HashSet(); 1652 HashSet riseq_26 = new HashSet(); 1653 int max_27 = list.size(); 1654 for (int i_28 = 1; i_28 <= max_27; i_28++) 1655 riseq_26.add(new Long(i_28)); 1656 e_set_24 = riseq_26; 1657 Long i = null; 1658 { 1659 for (Iterator enm_30 = e_set_24.iterator(); enm_30.hasNext() && !tmpQuant_9; ) { 1660 1661 Long elem_29 = UTIL.NumberToLong(enm_30.next()); 1662 i = elem_29; 1663 Boolean pred_10 = null; 1664 Boolean var1_11 = null; 1665 String var1_12 = null; 1666 XmlAttribute tmpRec_13 = null; 1667 if ((1 <= i.intValue()) && (i.intValue() <= list.size())) 1668 tmpRec_13 = (XmlAttribute) list.get(i.intValue() - 1); 1669 else 1670 UTIL.RunTime("Run-Time Error:Illegal index"); 1671 var1_12 = tmpRec_13.name; 1672 var1_11 = new Boolean(UTIL.equals(var1_12, name)); 1673 { 1674 if ((pred_10 = var1_11).booleanValue()) { 1675 1676 Boolean var2_17 = null; 1677 String var1_18 = null; 1678 XmlAttribute tmpRec_19 = null; 1679 if ((1 <= i.intValue()) && (i.intValue() <= list.size())) 1680 tmpRec_19 = (XmlAttribute) list.get(i.intValue() - 1); 1681 else 1682 UTIL.RunTime("Run-Time Error:Illegal index"); 1683 var1_18 = tmpRec_19.val; 1684 var2_17 = new Boolean(UTIL.equals(var1_18, val)); 1685 pred_10 = var2_17; 1686 } 1687 } 1688 if (pred_10.booleanValue()) 1689 tmpQuant_9 = true; 1690 } 1691 } 1692 } 1693 varRes_4 = new Boolean(tmpQuant_9); 1694 } 1695 return varRes_4; 1696 } 1697 // ***** VDMTOOLS END Name=hasAttributeValue#3|XmlEntity|String|String 1698 1699 1700 // ***** VDMTOOLS START Name=isAttributeType#2|XmlEntity|String KEEP=NO 1701 private Boolean isAttributeType (final XmlEntity e, final String val) throws CGException { 1702 return hasAttributeValue((XmlEntity) e, new String("xmi:type"), val); 1703 } 1704 // ***** VDMTOOLS END Name=isAttributeType#2|XmlEntity|String 1705 1706 1707 // ***** VDMTOOLS START Name=getElementType#1|XmlEntity KEEP=NO 1708 private String getElementType (final XmlEntity e) throws CGException { 1709 1710 String varRes_2 = null; 1711 if ((!UTIL.equals((XmlAttribute) getAttribute((XmlEntity) e, new String("xmi:type")), null))) 1712 varRes_2 = ((XmlAttribute) getAttribute((XmlEntity) e, new String("xmi:type"))).val; 1713 else 1714 varRes_2 = e.name; 1715 return varRes_2; 1716 } 1717 // ***** VDMTOOLS END Name=getElementType#1|XmlEntity 1718 1719 1720 // ***** VDMTOOLS START Name=getAttribute#2|XmlEntity|String KEEP=NO 1721 private XmlAttribute getAttribute (final XmlEntity e, final String name) throws CGException { 1722 1723 XmlAttribute varRes_3 = null; 1724 { 1725 1726 Vector tmpVal_5 = null; 1727 XmlAttributeList tmpRec_6 = null; 1728 tmpRec_6 = e.attributes; 1729 tmpVal_5 = tmpRec_6.attributes; 1730 Vector list = null; 1731 list = tmpVal_5; 1732 Vector attList = null; 1733 { 1734 1735 Vector res_l_9 = new Vector(); 1736 HashSet resBind_s_11 = new HashSet(); 1737 HashSet riseq_15 = new HashSet(); 1738 int max_16 = list.size(); 1739 for (int i_17 = 1; i_17 <= max_16; i_17++) 1740 riseq_15.add(new Long(i_17)); 1741 resBind_s_11 = riseq_15; 1742 Vector bind_l_10 = null; 1743 bind_l_10 = UTIL.Sort(resBind_s_11); 1744 Long i = null; 1745 for (Iterator enm_28 = bind_l_10.iterator(); enm_28.hasNext(); ) { 1746 1747 Long e_13 = UTIL.NumberToLong(enm_28.next()); 1748 i = e_13; 1749 Boolean pred_21 = null; 1750 String var1_22 = null; 1751 XmlAttribute tmpRec_23 = null; 1752 if ((1 <= i.intValue()) && (i.intValue() <= list.size())) 1753 tmpRec_23 = (XmlAttribute) list.get(i.intValue() - 1); 1754 else 1755 UTIL.RunTime("Run-Time Error:Illegal index"); 1756 var1_22 = tmpRec_23.name; 1757 pred_21 = new Boolean(UTIL.equals(var1_22, name)); 1758 if (pred_21.booleanValue()) { 1759 1760 XmlAttribute reselem_18 = null; 1761 if ((1 <= i.intValue()) && (i.intValue() <= list.size())) 1762 reselem_18 = (XmlAttribute) list.get(i.intValue() - 1); 1763 else 1764 UTIL.RunTime("Run-Time Error:Illegal index"); 1765 res_l_9.add(reselem_18); 1766 } 1767 } 1768 attList = res_l_9; 1769 } 1770 if (((new Long(attList.size()).intValue()) > (new Long(0).intValue()))) 1771 varRes_3 = (XmlAttribute) (XmlAttribute) attList.get(0); 1772 else 1773 varRes_3 = null; 1774 } 1775 return (XmlAttribute) varRes_3; 1776 } 1777 // ***** VDMTOOLS END Name=getAttribute#2|XmlEntity|String 1778 1779 1780 // ***** VDMTOOLS START Name=GetVisibility#1|XmlAttribute KEEP=NO 1781 static private IUmlVisibilityKind GetVisibility (final XmlAttribute v) throws CGException { 1782 1783 UmlVisibilityKind varRes_2 = null; 1784 if ((!UTIL.equals(v, null))) { 1785 1786 String selRes_9 = null; 1787 selRes_9 = v.val; 1788 boolean succ_8 = true; 1789 { 1790 1791 succ_8 = true; 1792 if (!UTIL.equals(selRes_9, new String("private"))) 1793 succ_8 = false; 1794 if (succ_8) 1795 varRes_2 = (UmlVisibilityKind) new UmlVisibilityKind(UmlVisibilityKindQuotes.IQPRIVATE); 1796 } 1797 if (!succ_8) { 1798 1799 succ_8 = true; 1800 if (!UTIL.equals(selRes_9, new String("public"))) 1801 succ_8 = false; 1802 if (succ_8) 1803 varRes_2 = (UmlVisibilityKind) new UmlVisibilityKind(UmlVisibilityKindQuotes.IQPUBLIC); 1804 } 1805 if (!succ_8) { 1806 1807 succ_8 = true; 1808 if (!UTIL.equals(selRes_9, new String("protected"))) 1809 succ_8 = false; 1810 if (succ_8) 1811 varRes_2 = (UmlVisibilityKind) new UmlVisibilityKind(UmlVisibilityKindQuotes.IQPROTECTED); 1812 } 1813 if (!succ_8) 1814 UTIL.RunTime("Run-Time Error:No \'others\' branch in CasesExpr"); 1815 } 1816 else 1817 varRes_2 = (UmlVisibilityKind) new UmlVisibilityKind(UmlVisibilityKindQuotes.IQPRIVATE); 1818 return (IUmlVisibilityKind) varRes_2; 1819 } 1820 // ***** VDMTOOLS END Name=GetVisibility#1|XmlAttribute 1821 1822 1823 // ***** VDMTOOLS START Name=build_uCollobration#1|XmlEntity KEEP=NO 1824 private IUmlCollaboration build_uCollobration (final XmlEntity e) throws CGException { 1825 1826 Vector tmpVal_3 = null; 1827 XmlEntityList tmpRec_4 = null; 1828 tmpRec_4 = e.entities; 1829 tmpVal_3 = tmpRec_4.entities; 1830 Vector elist = null; 1831 elist = tmpVal_3; 1832 HashSet interactions = new HashSet(); 1833 HashSet res_s_7 = new HashSet(); 1834 { 1835 1836 HashSet e1_set_15 = new HashSet(elist); 1837 XmlEntity p = null; 1838 { 1839 for (Iterator enm_17 = e1_set_15.iterator(); enm_17.hasNext(); ) { 1840 1841 XmlEntity elem_16 = (XmlEntity) enm_17.next(); 1842 p = (XmlEntity) elem_16; 1843 if (isAttributeType((XmlEntity) p, new String("uml:Interaction")).booleanValue()) { 1844 res_s_7.add((IUmlInteraction) build_uInteraction((XmlEntity) p)); 1845 } 1846 } 1847 } 1848 } 1849 interactions = res_s_7; 1850 return (IUmlCollaboration) new UmlCollaboration(interactions); 1851 } 1852 // ***** VDMTOOLS END Name=build_uCollobration#1|XmlEntity 1853 1854 1855 // ***** VDMTOOLS START Name=build_uInteraction#1|XmlEntity KEEP=NO 1856 private IUmlInteraction build_uInteraction (final XmlEntity e) throws CGException { 1857 1858 Vector tmpVal_3 = null; 1859 XmlEntityList tmpRec_4 = null; 1860 tmpRec_4 = e.entities; 1861 tmpVal_3 = tmpRec_4.entities; 1862 Vector elist = null; 1863 elist = tmpVal_3; 1864 HashMap tmpVal_6 = new HashMap(); 1865 HashMap res_m_7 = new HashMap(); 1866 { 1867 1868 HashSet e1_set_20 = new HashSet(elist); 1869 XmlEntity p = null; 1870 { 1871 for (Iterator enm_22 = e1_set_20.iterator(); enm_22.hasNext(); ) { 1872 1873 XmlEntity elem_21 = (XmlEntity) enm_22.next(); 1874 p = (XmlEntity) elem_21; 1875 if (isAttributeType((XmlEntity) p, new String("uml:Property")).booleanValue()) { 1876 1877 String md_8 = null; 1878 md_8 = ((XmlAttribute) getAttribute((XmlEntity) p, new String("xmi:id"))).val; 1879 res_m_7.put(md_8, (IUmlProperty) build_uProperty((XmlEntity) p, new String(""))); 1880 } 1881 } 1882 } 1883 } 1884 tmpVal_6 = res_m_7; 1885 HashMap props = new HashMap(); 1886 props = tmpVal_6; 1887 { 1888 1889 HashMap rhs_23 = new HashMap(); 1890 HashMap modmap_24 = new HashMap(); 1891 HashMap res_m_27 = new HashMap(); 1892 { 1893 1894 HashSet e1_set_50 = new HashSet(elist); 1895 XmlEntity p = null; 1896 { 1897 for (Iterator enm_52 = e1_set_50.iterator(); enm_52.hasNext(); ) { 1898 1899 XmlEntity elem_51 = (XmlEntity) enm_52.next(); 1900 p = (XmlEntity) elem_51; 1901 Boolean pred_44 = null; 1902 String var1_45 = null; 1903 var1_45 = p.name; 1904 pred_44 = new Boolean(UTIL.equals(var1_45, new String("lifeline"))); 1905 if (pred_44.booleanValue()) { 1906 1907 String md_28 = null; 1908 md_28 = ((XmlAttribute) getAttribute((XmlEntity) p, new String("xmi:id"))).val; 1909 UmlLifeLine mr_32 = null; 1910 String arg_33 = null; 1911 arg_33 = ((XmlAttribute) getAttribute((XmlEntity) p, new String("name"))).val; 1912 IUmlType arg_34 = null; 1913 IUmlProperty obj_38 = null; 1914 String tmppar_40 = null; 1915 tmppar_40 = ((XmlAttribute) getAttribute((XmlEntity) p, new String("represents"))).val; 1916 obj_38 = (IUmlProperty) props.get(tmppar_40); 1917 arg_34 = (IUmlType) obj_38.getType(); 1918 mr_32 = new UmlLifeLine(arg_33, arg_34); 1919 res_m_27.put(md_28, mr_32); 1920 } 1921 } 1922 } 1923 } 1924 modmap_24 = res_m_27; 1925 rhs_23 = new HashMap(lifeLineMap); 1926 rhs_23.putAll(modmap_24); 1927 lifeLineMap = (HashMap) UTIL.clone(rhs_23); 1928 { 1929 1930 String tmpVal_54 = null; 1931 tmpVal_54 = ((XmlAttribute) getAttribute((XmlEntity) e, new String("name"))).val; 1932 String name = null; 1933 name = tmpVal_54; 1934 HashSet lifeLines = new HashSet(); 1935 lifeLines.clear(); 1936 lifeLines.addAll(lifeLineMap.values()); 1937 HashSet mosfragments = new HashSet(); 1938 HashSet res_s_61 = new HashSet(); 1939 { 1940 1941 HashSet e1_set_69 = new HashSet(elist); 1942 XmlEntity f = null; 1943 { 1944 for (Iterator enm_71 = e1_set_69.iterator(); enm_71.hasNext(); ) { 1945 1946 XmlEntity elem_70 = (XmlEntity) enm_71.next(); 1947 f = (XmlEntity) elem_70; 1948 if (isAttributeType((XmlEntity) f, new String("uml:MessageOccurrenceSpecification")).booleanValue()) { 1949 res_s_61.add((IUmlInteractionFragment) build_uFragment((XmlEntity) f)); 1950 } 1951 } 1952 } 1953 } 1954 mosfragments = res_s_61; 1955 HashSet besfragments = new HashSet(); 1956 HashSet res_s_73 = new HashSet(); 1957 { 1958 1959 HashSet e1_set_81 = new HashSet(elist); 1960 XmlEntity f = null; 1961 { 1962 for (Iterator enm_83 = e1_set_81.iterator(); enm_83.hasNext(); ) { 1963 1964 XmlEntity elem_82 = (XmlEntity) enm_83.next(); 1965 f = (XmlEntity) elem_82; 1966 if (isAttributeType((XmlEntity) f, new String("uml:BehaviorExecutionSpecification")).booleanValue()) { 1967 res_s_73.add((IUmlInteractionFragment) build_uFragment((XmlEntity) f)); 1968 } 1969 } 1970 } 1971 } 1972 besfragments = res_s_73; 1973 HashSet combifragments = new HashSet(); 1974 HashSet res_s_85 = new HashSet(); 1975 { 1976 1977 HashSet e1_set_93 = new HashSet(elist); 1978 XmlEntity f = null; 1979 { 1980 for (Iterator enm_95 = e1_set_93.iterator(); enm_95.hasNext(); ) { 1981 1982 XmlEntity elem_94 = (XmlEntity) enm_95.next(); 1983 f = (XmlEntity) elem_94; 1984 if (isAttributeType((XmlEntity) f, new String("uml:CombinedFragment")).booleanValue()) { 1985 res_s_85.add((IUmlInteractionFragment) build_uFragment((XmlEntity) f)); 1986 } 1987 } 1988 } 1989 } 1990 combifragments = res_s_85; 1991 Vector messages = null; 1992 { 1993 1994 Vector res_l_97 = new Vector(); 1995 HashSet resBind_s_99 = new HashSet(); 1996 HashSet riseq_103 = new HashSet(); 1997 int max_104 = elist.size(); 1998 for (int i_105 = 1; i_105 <= max_104; i_105++) 1999 riseq_103.add(new Long(i_105)); 2000 resBind_s_99 = riseq_103; 2001 Vector bind_l_98 = null; 2002 bind_l_98 = UTIL.Sort(resBind_s_99); 2003 Long i = null; 2004 for (Iterator enm_117 = bind_l_98.iterator(); enm_117.hasNext(); ) { 2005 2006 Long e_101 = UTIL.NumberToLong(enm_117.next()); 2007 i = e_101; 2008 Boolean pred_110 = null; 2009 String var1_111 = null; 2010 XmlEntity tmpRec_112 = null; 2011 if ((1 <= i.intValue()) && (i.intValue() <= elist.size())) 2012 tmpRec_112 = (XmlEntity) elist.get(i.intValue() - 1); 2013 else 2014 UTIL.RunTime("Run-Time Error:Illegal index"); 2015 var1_111 = tmpRec_112.name; 2016 pred_110 = new Boolean(UTIL.equals(var1_111, new String("message"))); 2017 if (pred_110.booleanValue()) { 2018 2019 IUmlMessage reselem_106 = null; 2020 XmlEntity par_107 = null; 2021 if ((1 <= i.intValue()) && (i.intValue() <= elist.size())) 2022 par_107 = (XmlEntity) elist.get(i.intValue() - 1); 2023 else 2024 UTIL.RunTime("Run-Time Error:Illegal index"); 2025 reselem_106 = (IUmlMessage) build_uMessage((XmlEntity) par_107); 2026 res_l_97.add(reselem_106); 2027 } 2028 } 2029 messages = res_l_97; 2030 } 2031 UmlInteraction rexpr_118 = null; 2032 HashSet arg_121 = new HashSet(); 2033 HashSet var1_123 = new HashSet(); 2034 var1_123 = (HashSet) mosfragments.clone(); 2035 var1_123.addAll(besfragments); 2036 arg_121 = (HashSet) var1_123.clone(); 2037 arg_121.addAll(combifragments); 2038 rexpr_118 = new UmlInteraction(name, lifeLines, arg_121, messages); 2039 return (IUmlInteraction) rexpr_118; 2040 } 2041 } 2042 } 2043 // ***** VDMTOOLS END Name=build_uInteraction#1|XmlEntity 2044 2045 2046 // ***** VDMTOOLS START Name=build_uMessage#1|XmlEntity KEEP=NO 2047 private IUmlMessage build_uMessage (final XmlEntity e) throws CGException { 2048 2049 IUmlMessageKind messageKind = (IUmlMessageKind) new UmlMessageKind(UmlMessageKindQuotes.IQCOMPLETE); 2050 IUmlMessageSort messageSort = (IUmlMessageSort) new UmlMessageSort(UmlMessageSortQuotes.IQSYNCHCALL); 2051 IUmlMos mosSend = null; 2052 String tmppar_9 = null; 2053 tmppar_9 = ((XmlAttribute) getAttribute((XmlEntity) e, new String("sendEvent"))).val; 2054 mosSend = (IUmlMos) mosMap.get(tmppar_9); 2055 IUmlMos mosRecive = null; 2056 String tmppar_15 = null; 2057 tmppar_15 = ((XmlAttribute) getAttribute((XmlEntity) e, new String("receiveEvent"))).val; 2058 mosRecive = (IUmlMos) mosMap.get(tmppar_15); 2059 Vector args = new Vector(); 2060 String name = null; 2061 IUmlOperation obj_21 = null; 2062 IUmlCallEvent obj_22 = null; 2063 obj_22 = (IUmlCallEvent) mosRecive.getEvent(); 2064 obj_21 = (IUmlOperation) obj_22.getOperation(); 2065 name = obj_21.getName(); 2066 return (IUmlMessage) new UmlMessage(name, messageKind, messageSort, mosSend, mosRecive, args); 2067 } 2068 // ***** VDMTOOLS END Name=build_uMessage#1|XmlEntity 2069 2070 2071 // ***** VDMTOOLS START Name=build_uFragment#1|XmlEntity KEEP=NO 2072 private IUmlInteractionFragment build_uFragment (final XmlEntity e) throws CGException { 2073 2074 boolean succ_2 = true; 2075 { 2076 2077 succ_2 = true; 2078 if (!UTIL.equals(getElementType((XmlEntity) e), new String("uml:MessageOccurrenceSpecification"))) 2079 succ_2 = false; 2080 if (succ_2) 2081 return (IUmlInteractionFragment) (IUmlMos) build_uMos((XmlEntity) e); 2082 else { 2083 2084 succ_2 = true; 2085 if (!UTIL.equals(getElementType((XmlEntity) e), new String("uml:BehaviorExecutionSpecification"))) 2086 succ_2 = false; 2087 if (succ_2) 2088 return (IUmlInteractionFragment) (IUmlBes) build_uBes((XmlEntity) e); 2089 else { 2090 2091 succ_2 = true; 2092 if (!UTIL.equals(getElementType((XmlEntity) e), new String("uml:CombinedFragment"))) 2093 succ_2 = false; 2094 if (succ_2) 2095 return (IUmlInteractionFragment) (IUmlCombinedFragment) build_uCombi((XmlEntity) e); 2096 else { 2097 2098 UTIL.RunTime("Run-Time Error:Can not evaluate an error statement"); 2099 throw new CGException(); // throw new CGException(); // throw new CGException(); // throw new CGException(); // throw new CGException(); // throw new CGException(); // throw new CGException(); // throw new CGException(); // return new IUmlInteractionFragment(); 2100 } 2101 } 2102 } 2103 } 2104 } 2105 // ***** VDMTOOLS END Name=build_uFragment#1|XmlEntity 2106 2107 2108 // ***** VDMTOOLS START Name=build_uMos#1|XmlEntity KEEP=NO 2109 private IUmlMos build_uMos (final XmlEntity e) throws CGException { 2110 2111 String name = null; 2112 name = ((XmlAttribute) getAttribute((XmlEntity) e, new String("name"))).val; 2113 IUmlMessage message = null; 2114 IUmlLifeLine lifeLines = null; 2115 { 2116 2117 HashSet tmpSet_9 = new HashSet(); 2118 HashSet res_s_13 = new HashSet(); 2119 { 2120 2121 HashSet e1_set_20 = new HashSet(GetCovered((XmlEntity) e)); 2122 String c = null; 2123 { 2124 for (Iterator enm_22 = e1_set_20.iterator(); enm_22.hasNext(); ) { 2125 2126 String elem_21 = UTIL.ConvertToString(enm_22.next()); 2127 c = elem_21; 2128 res_s_13.add((IUmlLifeLine) lifeLineMap.get(c)); 2129 } 2130 } 2131 } 2132 tmpSet_9 = res_s_13; 2133 IUmlLifeLine l = null; 2134 boolean succ_11 = false; 2135 for (Iterator enm_23 = tmpSet_9.iterator(); enm_23.hasNext() && !succ_11; ) { 2136 2137 IUmlLifeLine tmpElem_12 = (IUmlLifeLine) enm_23.next(); 2138 succ_11 = true; 2139 l = (IUmlLifeLine) tmpElem_12; 2140 } 2141 if (!succ_11) 2142 UTIL.RunTime("Run-Time Error:The binding environment was empty"); 2143 lifeLines = (IUmlLifeLine) l; 2144 } 2145 String id = null; 2146 id = ((XmlAttribute) getAttribute((XmlEntity) e, new String("xmi:id"))).val; 2147 IUmlCallEvent event = null; 2148 String tmppar_30 = null; 2149 tmppar_30 = ((XmlAttribute) getAttribute((XmlEntity) e, new String("event"))).val; 2150 event = (IUmlCallEvent) idToClallEventMap.get(tmppar_30); 2151 UmlMos mos = (UmlMos) new UmlMos(name, message, lifeLines, event); 2152 { 2153 2154 mosMap.put(id, mos); 2155 return (IUmlMos) mos; 2156 } 2157 } 2158 // ***** VDMTOOLS END Name=build_uMos#1|XmlEntity 2159 2160 2161 // ***** VDMTOOLS START Name=build_uBes#1|XmlEntity KEEP=NO 2162 private IUmlBes build_uBes (final XmlEntity e) throws CGException { 2163 2164 String name = null; 2165 name = ((XmlAttribute) getAttribute((XmlEntity) e, new String("name"))).val; 2166 IUmlMos startOc = null; 2167 String tmppar_9 = null; 2168 tmppar_9 = ((XmlAttribute) getAttribute((XmlEntity) e, new String("start"))).val; 2169 startOc = (IUmlMos) mosMap.get(tmppar_9); 2170 IUmlMos finishOc = null; 2171 String tmppar_15 = null; 2172 tmppar_15 = ((XmlAttribute) getAttribute((XmlEntity) e, new String("finish"))).val; 2173 finishOc = (IUmlMos) mosMap.get(tmppar_15); 2174 HashSet covered = new HashSet(); 2175 HashSet res_s_20 = new HashSet(); 2176 { 2177 2178 HashSet e1_set_27 = new HashSet(GetCovered((XmlEntity) e)); 2179 String c = null; 2180 { 2181 for (Iterator enm_29 = e1_set_27.iterator(); enm_29.hasNext(); ) { 2182 2183 String elem_28 = UTIL.ConvertToString(enm_29.next()); 2184 c = elem_28; 2185 res_s_20.add((IUmlLifeLine) lifeLineMap.get(c)); 2186 } 2187 } 2188 } 2189 covered = res_s_20; 2190 String id = null; 2191 id = ((XmlAttribute) getAttribute((XmlEntity) e, new String("xmi:id"))).val; 2192 UmlBes bes = (UmlBes) new UmlBes(name, startOc, finishOc, covered); 2193 { 2194 2195 besMap.put(id, bes); 2196 return (IUmlBes) bes; 2197 } 2198 } 2199 // ***** VDMTOOLS END Name=build_uBes#1|XmlEntity 2200 2201 2202 // ***** VDMTOOLS START Name=build_uCombi#1|XmlEntity KEEP=NO 2203 private IUmlCombinedFragment build_uCombi (final XmlEntity e) throws CGException { 2204 2205 Vector elist = null; 2206 XmlEntityList tmpRec_4 = null; 2207 tmpRec_4 = e.entities; 2208 elist = tmpRec_4.entities; 2209 String name = null; 2210 name = ((XmlAttribute) getAttribute((XmlEntity) e, new String("name"))).val; 2211 IUmlInteractionOperatorKind interactionOperatorKind = null; 2212 String par_11 = null; 2213 par_11 = ((XmlAttribute) getAttribute((XmlEntity) e, new String("interactionOperator"))).val; 2214 interactionOperatorKind = (IUmlInteractionOperatorKind) GetIntOperationKind(par_11); 2215 Vector operands = null; 2216 { 2217 2218 Vector res_l_16 = new Vector(); 2219 HashSet resBind_s_18 = new HashSet(); 2220 HashSet riseq_22 = new HashSet(); 2221 int max_23 = elist.size(); 2222 for (int i_24 = 1; i_24 <= max_23; i_24++) 2223 riseq_22.add(new Long(i_24)); 2224 resBind_s_18 = riseq_22; 2225 Vector bind_l_17 = null; 2226 bind_l_17 = UTIL.Sort(resBind_s_18); 2227 Long i = null; 2228 for (Iterator enm_36 = bind_l_17.iterator(); enm_36.hasNext(); ) { 2229 2230 Long e_20 = UTIL.NumberToLong(enm_36.next()); 2231 i = e_20; 2232 Boolean pred_29 = null; 2233 String var1_30 = null; 2234 XmlEntity tmpRec_31 = null; 2235 if ((1 <= i.intValue()) && (i.intValue() <= elist.size())) 2236 tmpRec_31 = (XmlEntity) elist.get(i.intValue() - 1); 2237 else 2238 UTIL.RunTime("Run-Time Error:Illegal index"); 2239 var1_30 = tmpRec_31.name; 2240 pred_29 = new Boolean(UTIL.equals(var1_30, new String("operand"))); 2241 if (pred_29.booleanValue()) { 2242 2243 IUmlInteractionOperand reselem_25 = null; 2244 XmlEntity par_26 = null; 2245 if ((1 <= i.intValue()) && (i.intValue() <= elist.size())) 2246 par_26 = (XmlEntity) elist.get(i.intValue() - 1); 2247 else 2248 UTIL.RunTime("Run-Time Error:Illegal index"); 2249 reselem_25 = (IUmlInteractionOperand) build_uOperand((XmlEntity) par_26); 2250 res_l_16.add(reselem_25); 2251 } 2252 } 2253 operands = res_l_16; 2254 } 2255 HashSet covered = new HashSet(); 2256 HashSet res_s_38 = new HashSet(); 2257 { 2258 2259 HashSet e1_set_45 = new HashSet(GetCovered((XmlEntity) e)); 2260 String c = null; 2261 { 2262 for (Iterator enm_47 = e1_set_45.iterator(); enm_47.hasNext(); ) { 2263 2264 String elem_46 = UTIL.ConvertToString(enm_47.next()); 2265 c = elem_46; 2266 res_s_38.add((IUmlLifeLine) lifeLineMap.get(c)); 2267 } 2268 } 2269 } 2270 covered = res_s_38; 2271 String id = null; 2272 id = ((XmlAttribute) getAttribute((XmlEntity) e, new String("xmi:id"))).val; 2273 UmlCombinedFragment combi = (UmlCombinedFragment) new UmlCombinedFragment(name, interactionOperatorKind, operands, covered); 2274 { 2275 2276 combiMap.put(id, combi); 2277 return (IUmlCombinedFragment) combi; 2278 } 2279 } 2280 // ***** VDMTOOLS END Name=build_uCombi#1|XmlEntity 2281 2282 2283 // ***** VDMTOOLS START Name=GetIntOperationKind#1|String KEEP=NO 2284 private IUmlInteractionOperatorKind GetIntOperationKind (final String text) throws CGException { 2285 2286 UmlInteractionOperatorKind varRes_2 = null; 2287 boolean succ_3 = true; 2288 { 2289 2290 succ_3 = true; 2291 if (!UTIL.equals(text, new String("alt"))) 2292 succ_3 = false; 2293 if (succ_3) 2294 varRes_2 = (UmlInteractionOperatorKind) new UmlInteractionOperatorKind(UmlInteractionOperatorKindQuotes.IQALT); 2295 } 2296 if (!succ_3) { 2297 2298 succ_3 = true; 2299 if (!UTIL.equals(text, new String("loop"))) 2300 succ_3 = false; 2301 if (succ_3) 2302 varRes_2 = (UmlInteractionOperatorKind) new UmlInteractionOperatorKind(UmlInteractionOperatorKindQuotes.IQLOOP); 2303 } 2304 if (!succ_3) 2305 UTIL.RunTime("Run-Time Error:No \'others\' branch in CasesExpr"); 2306 return (IUmlInteractionOperatorKind) varRes_2; 2307 } 2308 // ***** VDMTOOLS END Name=GetIntOperationKind#1|String 2309 2310 2311 // ***** VDMTOOLS START Name=build_uOperand#1|XmlEntity KEEP=NO 2312 private IUmlInteractionOperand build_uOperand (final XmlEntity e) throws CGException { 2313 2314 Vector elist = null; 2315 XmlEntityList tmpRec_4 = null; 2316 tmpRec_4 = e.entities; 2317 elist = tmpRec_4.entities; 2318 String name = new String(""); 2319 Vector fragments = new Vector(); 2320 HashSet covered = new HashSet(); 2321 HashSet res_s_9 = new HashSet(); 2322 { 2323 2324 Vector e_set_14 = null; 2325 String par_15 = null; 2326 Vector unArg_16 = null; 2327 { 2328 2329 Vector res_l_17 = new Vector(); 2330 HashSet resBind_s_19 = new HashSet(); 2331 HashSet riseq_23 = new HashSet(); 2332 int max_24 = elist.size(); 2333 for (int i_25 = 1; i_25 <= max_24; i_25++) 2334 riseq_23.add(new Long(i_25)); 2335 resBind_s_19 = riseq_23; 2336 Vector bind_l_18 = null; 2337 bind_l_18 = UTIL.Sort(resBind_s_19); 2338 Long i = null; 2339 for (Iterator enm_37 = bind_l_18.iterator(); enm_37.hasNext(); ) { 2340 2341 Long e_21 = UTIL.NumberToLong(enm_37.next()); 2342 i = e_21; 2343 Boolean pred_30 = null; 2344 XmlEntity par_31 = null; 2345 if ((1 <= i.intValue()) && (i.intValue() <= elist.size())) 2346 par_31 = (XmlEntity) elist.get(i.intValue() - 1); 2347 else 2348 UTIL.RunTime("Run-Time Error:Illegal index"); 2349 pred_30 = hasAttributeValue((XmlEntity) par_31, new String("extender"), new String("umltrans")); 2350 if (pred_30.booleanValue()) { 2351 2352 String reselem_26 = null; 2353 XmlEntity par_27 = null; 2354 if ((1 <= i.intValue()) && (i.intValue() <= elist.size())) 2355 par_27 = (XmlEntity) elist.get(i.intValue() - 1); 2356 else 2357 UTIL.RunTime("Run-Time Error:Illegal index"); 2358 reselem_26 = GetCoveredExtension((XmlEntity) par_27); 2359 res_l_17.add(reselem_26); 2360 } 2361 } 2362 unArg_16 = res_l_17; 2363 } 2364 String rdcseq_38 = new String(); 2365 for (Iterator enm_41 = unArg_16.iterator(); enm_41.hasNext(); ) { 2366 2367 String e_39 = UTIL.ConvertToString(enm_41.next()); 2368 rdcseq_38 = rdcseq_38.concat(e_39); 2369 } 2370 par_15 = rdcseq_38; 2371 e_set_14 = (Vector) StdLib.Split(par_15, new Character(' ')); 2372 String c = null; 2373 { 2374 for (Iterator enm_44 = e_set_14.iterator(); enm_44.hasNext(); ) { 2375 2376 String elem_43 = UTIL.ConvertToString(enm_44.next()); 2377 c = elem_43; 2378 res_s_9.add((IUmlMos) mosMap.get(c)); 2379 } 2380 } 2381 } 2382 covered = res_s_9; 2383 IUmlInteractionConstraint guard = null; 2384 Boolean cond_47 = null; 2385 boolean tmpQuant_48 = false; 2386 { 2387 2388 HashSet e1_set_55 = new HashSet(elist); 2389 XmlEntity gu = null; 2390 { 2391 for (Iterator enm_57 = e1_set_55.iterator(); enm_57.hasNext() && !tmpQuant_48; ) { 2392 2393 XmlEntity elem_56 = (XmlEntity) enm_57.next(); 2394 gu = (XmlEntity) elem_56; 2395 Boolean pred_49 = null; 2396 String var1_50 = null; 2397 var1_50 = gu.name; 2398 pred_49 = new Boolean(UTIL.equals(var1_50, new String("guard"))); 2399 if (pred_49.booleanValue()) 2400 tmpQuant_48 = true; 2401 } 2402 } 2403 } 2404 cond_47 = new Boolean(tmpQuant_48); 2405 if (cond_47.booleanValue()) { 2406 2407 XmlEntity par_58 = null; 2408 { 2409 2410 HashSet tmpSet_59 = new HashSet(); 2411 HashSet res_s_63 = new HashSet(); 2412 { 2413 2414 HashSet e1_set_71 = new HashSet(elist); 2415 XmlEntity p = null; 2416 { 2417 for (Iterator enm_73 = e1_set_71.iterator(); enm_73.hasNext(); ) { 2418 2419 XmlEntity elem_72 = (XmlEntity) enm_73.next(); 2420 p = (XmlEntity) elem_72; 2421 Boolean pred_65 = null; 2422 String var1_66 = null; 2423 var1_66 = p.name; 2424 pred_65 = new Boolean(UTIL.equals(var1_66, new String("guard"))); 2425 if (pred_65.booleanValue()) { 2426 res_s_63.add(p); 2427 } 2428 } 2429 } 2430 } 2431 tmpSet_59 = res_s_63; 2432 XmlEntity g = null; 2433 boolean succ_61 = false; 2434 for (Iterator enm_74 = tmpSet_59.iterator(); enm_74.hasNext() && !succ_61; ) { 2435 2436 XmlEntity tmpElem_62 = (XmlEntity) enm_74.next(); 2437 succ_61 = true; 2438 g = (XmlEntity) tmpElem_62; 2439 } 2440 if (!succ_61) 2441 UTIL.RunTime("Run-Time Error:The binding environment was empty"); 2442 par_58 = (XmlEntity) g; 2443 } 2444 guard = (IUmlInteractionConstraint) GetGuard((XmlEntity) par_58); 2445 } 2446 else 2447 guard = null; 2448 return (IUmlInteractionOperand) new UmlInteractionOperand(name, fragments, covered, guard); 2449 } 2450 // ***** VDMTOOLS END Name=build_uOperand#1|XmlEntity 2451 2452 2453 // ***** VDMTOOLS START Name=GetCoveredExtension#1|XmlEntity KEEP=NO 2454 private String GetCoveredExtension (final XmlEntity e) throws CGException { 2455 2456 String varRes_2 = null; 2457 { 2458 2459 Vector elist = null; 2460 XmlEntityList tmpRec_5 = null; 2461 tmpRec_5 = e.entities; 2462 elist = tmpRec_5.entities; 2463 { 2464 2465 HashSet tmpSet_7 = new HashSet(); 2466 HashSet res_s_11 = new HashSet(); 2467 { 2468 2469 HashSet e1_set_21 = new HashSet(elist); 2470 XmlEntity co = null; 2471 { 2472 for (Iterator enm_23 = e1_set_21.iterator(); enm_23.hasNext(); ) { 2473 2474 XmlEntity elem_22 = (XmlEntity) enm_23.next(); 2475 co = (XmlEntity) elem_22; 2476 Boolean pred_15 = null; 2477 String var1_16 = null; 2478 var1_16 = co.name; 2479 pred_15 = new Boolean(UTIL.equals(var1_16, new String("covered"))); 2480 if (pred_15.booleanValue()) { 2481 2482 String res_s_12 = null; 2483 XmlData tmpRec_13 = null; 2484 tmpRec_13 = co.data; 2485 res_s_12 = tmpRec_13.data; 2486 res_s_11.add(res_s_12); 2487 } 2488 } 2489 } 2490 } 2491 tmpSet_7 = res_s_11; 2492 String p = null; 2493 boolean succ_9 = false; 2494 for (Iterator enm_24 = tmpSet_7.iterator(); enm_24.hasNext() && !succ_9; ) { 2495 2496 String tmpElem_10 = UTIL.ConvertToString(enm_24.next()); 2497 succ_9 = true; 2498 p = tmpElem_10; 2499 } 2500 if (!succ_9) 2501 UTIL.RunTime("Run-Time Error:The binding environment was empty"); 2502 varRes_2 = p; 2503 } 2504 } 2505 return varRes_2; 2506 } 2507 // ***** VDMTOOLS END Name=GetCoveredExtension#1|XmlEntity 2508 2509 2510 // ***** VDMTOOLS START Name=GetCovered#1|XmlEntity KEEP=NO 2511 private Vector GetCovered (final XmlEntity e) throws CGException { 2512 2513 Vector varRes_2 = null; 2514 { 2515 2516 String text = null; 2517 text = ((XmlAttribute) getAttribute((XmlEntity) e, new String("covered"))).val; 2518 varRes_2 = (Vector) StdLib.Split(text, new Character(' ')); 2519 } 2520 return varRes_2; 2521 } 2522 // ***** VDMTOOLS END Name=GetCovered#1|XmlEntity 2523 2524 2525 // ***** VDMTOOLS START Name=GetGuard#1|XmlEntity KEEP=NO 2526 private IUmlInteractionConstraint GetGuard (final XmlEntity e) throws CGException { 2527 2528 UmlInteractionConstraint varRes_2 = null; 2529 { 2530 2531 Vector elist = null; 2532 XmlEntityList tmpRec_5 = null; 2533 tmpRec_5 = e.entities; 2534 elist = tmpRec_5.entities; 2535 IUmlValueSpecification minint = null; 2536 { 2537 2538 HashSet tmpSet_8 = new HashSet(); 2539 HashSet res_s_12 = new HashSet(); 2540 { 2541 2542 HashSet e1_set_21 = new HashSet(elist); 2543 XmlEntity p = null; 2544 { 2545 for (Iterator enm_23 = e1_set_21.iterator(); enm_23.hasNext(); ) { 2546 2547 XmlEntity elem_22 = (XmlEntity) enm_23.next(); 2548 p = (XmlEntity) elem_22; 2549 Boolean pred_15 = null; 2550 String var1_16 = null; 2551 var1_16 = p.name; 2552 pred_15 = new Boolean(UTIL.equals(var1_16, new String("minint"))); 2553 if (pred_15.booleanValue()) { 2554 res_s_12.add((IUmlValueSpecification) getGuardConstraintValue((XmlEntity) p)); 2555 } 2556 } 2557 } 2558 } 2559 tmpSet_8 = res_s_12; 2560 IUmlValueSpecification tmp = null; 2561 boolean succ_10 = false; 2562 for (Iterator enm_24 = tmpSet_8.iterator(); enm_24.hasNext() && !succ_10; ) { 2563 2564 IUmlValueSpecification tmpElem_11 = (IUmlValueSpecification) enm_24.next(); 2565 succ_10 = true; 2566 tmp = (IUmlValueSpecification) tmpElem_11; 2567 } 2568 if (!succ_10) 2569 UTIL.RunTime("Run-Time Error:The binding environment was empty"); 2570 minint = (IUmlValueSpecification) tmp; 2571 } 2572 IUmlValueSpecification maxint = null; 2573 { 2574 2575 HashSet tmpSet_26 = new HashSet(); 2576 HashSet res_s_30 = new HashSet(); 2577 { 2578 2579 HashSet e1_set_39 = new HashSet(elist); 2580 XmlEntity p = null; 2581 { 2582 for (Iterator enm_41 = e1_set_39.iterator(); enm_41.hasNext(); ) { 2583 2584 XmlEntity elem_40 = (XmlEntity) enm_41.next(); 2585 p = (XmlEntity) elem_40; 2586 Boolean pred_33 = null; 2587 String var1_34 = null; 2588 var1_34 = p.name; 2589 pred_33 = new Boolean(UTIL.equals(var1_34, new String("maxint"))); 2590 if (pred_33.booleanValue()) { 2591 res_s_30.add((IUmlValueSpecification) getGuardConstraintValue((XmlEntity) p)); 2592 } 2593 } 2594 } 2595 } 2596 tmpSet_26 = res_s_30; 2597 IUmlValueSpecification tmp = null; 2598 boolean succ_28 = false; 2599 for (Iterator enm_42 = tmpSet_26.iterator(); enm_42.hasNext() && !succ_28; ) { 2600 2601 IUmlValueSpecification tmpElem_29 = (IUmlValueSpecification) enm_42.next(); 2602 succ_28 = true; 2603 tmp = (IUmlValueSpecification) tmpElem_29; 2604 } 2605 if (!succ_28) 2606 UTIL.RunTime("Run-Time Error:The binding environment was empty"); 2607 maxint = (IUmlValueSpecification) tmp; 2608 } 2609 varRes_2 = (UmlInteractionConstraint) new UmlInteractionConstraint(minint, maxint); 2610 } 2611 return (IUmlInteractionConstraint) varRes_2; 2612 } 2613 // ***** VDMTOOLS END Name=GetGuard#1|XmlEntity 2614 2615 2616 // ***** VDMTOOLS START Name=getGuardConstraintValue#1|XmlEntity KEEP=NO 2617 private IUmlValueSpecification getGuardConstraintValue (final XmlEntity e) throws CGException { 2618 2619 UmlLiteralInteger varRes_2 = null; 2620 Boolean cond_4 = null; 2621 { 2622 if ((cond_4 = hasAttribute((XmlEntity) e, new String("value"))).booleanValue()) 2623 cond_4 = isAttributeType((XmlEntity) e, new String("uml:LiteralInteger")); 2624 } 2625 if (cond_4.booleanValue()) { 2626 2627 Long arg_11 = null; 2628 String par_12 = null; 2629 par_12 = ((XmlAttribute) getAttribute((XmlEntity) e, new String("value"))).val; 2630 arg_11 = UTIL.NumberToLong(StdLib.StringToInt(par_12)); 2631 varRes_2 = new UmlLiteralInteger(arg_11); 2632 } 2633 else 2634 varRes_2 = null; 2635 return (IUmlValueSpecification) varRes_2; 2636 } 2637 // ***** VDMTOOLS END Name=getGuardConstraintValue#1|XmlEntity 2638 2639 2640 // ***** VDMTOOLS START Name=buildCallEventMap#1|HashSet KEEP=NO 2641 private HashMap buildCallEventMap (final HashSet elist) throws CGException { 2642 2643 HashMap m = new HashMap(); 2644 HashMap res_m_4 = new HashMap(); 2645 { 2646 2647 XmlEntity e = null; 2648 { 2649 for (Iterator enm_19 = elist.iterator(); enm_19.hasNext(); ) { 2650 2651 XmlEntity elem_18 = (XmlEntity) enm_19.next(); 2652 e = (XmlEntity) elem_18; 2653 String md_5 = null; 2654 md_5 = ((XmlAttribute) getAttribute((XmlEntity) e, new String("xmi:id"))).val; 2655 UmlCallEvent mr_9 = null; 2656 IUmlOperation arg_10 = null; 2657 String tmppar_12 = null; 2658 tmppar_12 = ((XmlAttribute) getAttribute((XmlEntity) e, new String("operation"))).val; 2659 arg_10 = (IUmlOperation) idToOperationMap.get(tmppar_12); 2660 mr_9 = new UmlCallEvent(arg_10); 2661 res_m_4.put(md_5, mr_9); 2662 } 2663 } 2664 } 2665 m = res_m_4; 2666 return m; 2667 } 2668 // ***** VDMTOOLS END Name=buildCallEventMap#1|HashSet 2669 2670 2671 // ***** VDMTOOLS START Name=VisitXmlAttribute#1|XmlAttribute KEEP=NO 2672 public void VisitXmlAttribute (final XmlAttribute var_1_1) throws CGException {} 2673 // ***** VDMTOOLS END Name=VisitXmlAttribute#1|XmlAttribute 2674 2675 2676 // ***** VDMTOOLS START Name=VisitXmlData#1|XmlData KEEP=NO 2677 public void VisitXmlData (final XmlData var_1_1) throws CGException {} 2678 // ***** VDMTOOLS END Name=VisitXmlData#1|XmlData 2679 2680 2681 // ***** VDMTOOLS START Name=setEncoding#1|String KEEP=NO 2682 public void setEncoding (final String encodingType) throws CGException {} 2683 // ***** VDMTOOLS END Name=setEncoding#1|String 2684 2685 } 2686 ;