1------------------------------------------------------------------------------ 2-- -- 3-- Matreshka Project -- 4-- -- 5-- Ada Modeling Framework -- 6-- -- 7-- Runtime Library Component -- 8-- -- 9------------------------------------------------------------------------------ 10-- -- 11-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> -- 12-- All rights reserved. -- 13-- -- 14-- Redistribution and use in source and binary forms, with or without -- 15-- modification, are permitted provided that the following conditions -- 16-- are met: -- 17-- -- 18-- * Redistributions of source code must retain the above copyright -- 19-- notice, this list of conditions and the following disclaimer. -- 20-- -- 21-- * Redistributions in binary form must reproduce the above copyright -- 22-- notice, this list of conditions and the following disclaimer in the -- 23-- documentation and/or other materials provided with the distribution. -- 24-- -- 25-- * Neither the name of the Vadim Godunko, IE nor the names of its -- 26-- contributors may be used to endorse or promote products derived from -- 27-- this software without specific prior written permission. -- 28-- -- 29-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- 30-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- 31-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- 32-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- 33-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- 34-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- 35-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- 36-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- 37-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- 38-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- 39-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- 40-- -- 41------------------------------------------------------------------------------ 42-- $Revision: 2937 $ $Date: 2012-05-01 21:07:27 +0400 (Tue, 01 May 2012) $ 43------------------------------------------------------------------------------ 44with AMF.Elements; 45with AMF.Internals.Element_Collections; 46with AMF.Internals.Helpers; 47with AMF.Internals.Tables.UML_Attributes; 48with AMF.Visitors.UML_Iterators; 49with AMF.Visitors.UML_Visitors; 50with League.Strings.Internals; 51with Matreshka.Internals.Strings; 52 53package body AMF.Internals.UML_Data_Store_Nodes is 54 55 ------------------- 56 -- Enter_Element -- 57 ------------------- 58 59 overriding procedure Enter_Element 60 (Self : not null access constant UML_Data_Store_Node_Proxy; 61 Visitor : in out AMF.Visitors.Abstract_Visitor'Class; 62 Control : in out AMF.Visitors.Traverse_Control) is 63 begin 64 if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then 65 AMF.Visitors.UML_Visitors.UML_Visitor'Class 66 (Visitor).Enter_Data_Store_Node 67 (AMF.UML.Data_Store_Nodes.UML_Data_Store_Node_Access (Self), 68 Control); 69 end if; 70 end Enter_Element; 71 72 ------------------- 73 -- Leave_Element -- 74 ------------------- 75 76 overriding procedure Leave_Element 77 (Self : not null access constant UML_Data_Store_Node_Proxy; 78 Visitor : in out AMF.Visitors.Abstract_Visitor'Class; 79 Control : in out AMF.Visitors.Traverse_Control) is 80 begin 81 if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then 82 AMF.Visitors.UML_Visitors.UML_Visitor'Class 83 (Visitor).Leave_Data_Store_Node 84 (AMF.UML.Data_Store_Nodes.UML_Data_Store_Node_Access (Self), 85 Control); 86 end if; 87 end Leave_Element; 88 89 ------------------- 90 -- Visit_Element -- 91 ------------------- 92 93 overriding procedure Visit_Element 94 (Self : not null access constant UML_Data_Store_Node_Proxy; 95 Iterator : in out AMF.Visitors.Abstract_Iterator'Class; 96 Visitor : in out AMF.Visitors.Abstract_Visitor'Class; 97 Control : in out AMF.Visitors.Traverse_Control) is 98 begin 99 if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then 100 AMF.Visitors.UML_Iterators.UML_Iterator'Class 101 (Iterator).Visit_Data_Store_Node 102 (Visitor, 103 AMF.UML.Data_Store_Nodes.UML_Data_Store_Node_Access (Self), 104 Control); 105 end if; 106 end Visit_Element; 107 108 ------------------ 109 -- Get_In_State -- 110 ------------------ 111 112 overriding function Get_In_State 113 (Self : not null access constant UML_Data_Store_Node_Proxy) 114 return AMF.UML.States.Collections.Set_Of_UML_State is 115 begin 116 return 117 AMF.UML.States.Collections.Wrap 118 (AMF.Internals.Element_Collections.Wrap 119 (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_State 120 (Self.Element))); 121 end Get_In_State; 122 123 ------------------------- 124 -- Get_Is_Control_Type -- 125 ------------------------- 126 127 overriding function Get_Is_Control_Type 128 (Self : not null access constant UML_Data_Store_Node_Proxy) 129 return Boolean is 130 begin 131 return 132 AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Control_Type 133 (Self.Element); 134 end Get_Is_Control_Type; 135 136 ------------------------- 137 -- Set_Is_Control_Type -- 138 ------------------------- 139 140 overriding procedure Set_Is_Control_Type 141 (Self : not null access UML_Data_Store_Node_Proxy; 142 To : Boolean) is 143 begin 144 AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Control_Type 145 (Self.Element, To); 146 end Set_Is_Control_Type; 147 148 ------------------ 149 -- Get_Ordering -- 150 ------------------ 151 152 overriding function Get_Ordering 153 (Self : not null access constant UML_Data_Store_Node_Proxy) 154 return AMF.UML.UML_Object_Node_Ordering_Kind is 155 begin 156 return 157 AMF.Internals.Tables.UML_Attributes.Internal_Get_Ordering 158 (Self.Element); 159 end Get_Ordering; 160 161 ------------------ 162 -- Set_Ordering -- 163 ------------------ 164 165 overriding procedure Set_Ordering 166 (Self : not null access UML_Data_Store_Node_Proxy; 167 To : AMF.UML.UML_Object_Node_Ordering_Kind) is 168 begin 169 AMF.Internals.Tables.UML_Attributes.Internal_Set_Ordering 170 (Self.Element, To); 171 end Set_Ordering; 172 173 ------------------- 174 -- Get_Selection -- 175 ------------------- 176 177 overriding function Get_Selection 178 (Self : not null access constant UML_Data_Store_Node_Proxy) 179 return AMF.UML.Behaviors.UML_Behavior_Access is 180 begin 181 return 182 AMF.UML.Behaviors.UML_Behavior_Access 183 (AMF.Internals.Helpers.To_Element 184 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Selection 185 (Self.Element))); 186 end Get_Selection; 187 188 ------------------- 189 -- Set_Selection -- 190 ------------------- 191 192 overriding procedure Set_Selection 193 (Self : not null access UML_Data_Store_Node_Proxy; 194 To : AMF.UML.Behaviors.UML_Behavior_Access) is 195 begin 196 AMF.Internals.Tables.UML_Attributes.Internal_Set_Selection 197 (Self.Element, 198 AMF.Internals.Helpers.To_Element 199 (AMF.Elements.Element_Access (To))); 200 end Set_Selection; 201 202 --------------------- 203 -- Get_Upper_Bound -- 204 --------------------- 205 206 overriding function Get_Upper_Bound 207 (Self : not null access constant UML_Data_Store_Node_Proxy) 208 return AMF.UML.Value_Specifications.UML_Value_Specification_Access is 209 begin 210 return 211 AMF.UML.Value_Specifications.UML_Value_Specification_Access 212 (AMF.Internals.Helpers.To_Element 213 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Upper_Bound 214 (Self.Element))); 215 end Get_Upper_Bound; 216 217 --------------------- 218 -- Set_Upper_Bound -- 219 --------------------- 220 221 overriding procedure Set_Upper_Bound 222 (Self : not null access UML_Data_Store_Node_Proxy; 223 To : AMF.UML.Value_Specifications.UML_Value_Specification_Access) is 224 begin 225 AMF.Internals.Tables.UML_Attributes.Internal_Set_Upper_Bound 226 (Self.Element, 227 AMF.Internals.Helpers.To_Element 228 (AMF.Elements.Element_Access (To))); 229 end Set_Upper_Bound; 230 231 ------------------ 232 -- Get_Activity -- 233 ------------------ 234 235 overriding function Get_Activity 236 (Self : not null access constant UML_Data_Store_Node_Proxy) 237 return AMF.UML.Activities.UML_Activity_Access is 238 begin 239 return 240 AMF.UML.Activities.UML_Activity_Access 241 (AMF.Internals.Helpers.To_Element 242 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Activity 243 (Self.Element))); 244 end Get_Activity; 245 246 ------------------ 247 -- Set_Activity -- 248 ------------------ 249 250 overriding procedure Set_Activity 251 (Self : not null access UML_Data_Store_Node_Proxy; 252 To : AMF.UML.Activities.UML_Activity_Access) is 253 begin 254 AMF.Internals.Tables.UML_Attributes.Internal_Set_Activity 255 (Self.Element, 256 AMF.Internals.Helpers.To_Element 257 (AMF.Elements.Element_Access (To))); 258 end Set_Activity; 259 260 ------------------ 261 -- Get_In_Group -- 262 ------------------ 263 264 overriding function Get_In_Group 265 (Self : not null access constant UML_Data_Store_Node_Proxy) 266 return AMF.UML.Activity_Groups.Collections.Set_Of_UML_Activity_Group is 267 begin 268 return 269 AMF.UML.Activity_Groups.Collections.Wrap 270 (AMF.Internals.Element_Collections.Wrap 271 (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Group 272 (Self.Element))); 273 end Get_In_Group; 274 275 --------------------------------- 276 -- Get_In_Interruptible_Region -- 277 --------------------------------- 278 279 overriding function Get_In_Interruptible_Region 280 (Self : not null access constant UML_Data_Store_Node_Proxy) 281 return AMF.UML.Interruptible_Activity_Regions.Collections.Set_Of_UML_Interruptible_Activity_Region is 282 begin 283 return 284 AMF.UML.Interruptible_Activity_Regions.Collections.Wrap 285 (AMF.Internals.Element_Collections.Wrap 286 (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Interruptible_Region 287 (Self.Element))); 288 end Get_In_Interruptible_Region; 289 290 ---------------------- 291 -- Get_In_Partition -- 292 ---------------------- 293 294 overriding function Get_In_Partition 295 (Self : not null access constant UML_Data_Store_Node_Proxy) 296 return AMF.UML.Activity_Partitions.Collections.Set_Of_UML_Activity_Partition is 297 begin 298 return 299 AMF.UML.Activity_Partitions.Collections.Wrap 300 (AMF.Internals.Element_Collections.Wrap 301 (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Partition 302 (Self.Element))); 303 end Get_In_Partition; 304 305 ---------------------------- 306 -- Get_In_Structured_Node -- 307 ---------------------------- 308 309 overriding function Get_In_Structured_Node 310 (Self : not null access constant UML_Data_Store_Node_Proxy) 311 return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access is 312 begin 313 return 314 AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access 315 (AMF.Internals.Helpers.To_Element 316 (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Structured_Node 317 (Self.Element))); 318 end Get_In_Structured_Node; 319 320 ---------------------------- 321 -- Set_In_Structured_Node -- 322 ---------------------------- 323 324 overriding procedure Set_In_Structured_Node 325 (Self : not null access UML_Data_Store_Node_Proxy; 326 To : AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access) is 327 begin 328 AMF.Internals.Tables.UML_Attributes.Internal_Set_In_Structured_Node 329 (Self.Element, 330 AMF.Internals.Helpers.To_Element 331 (AMF.Elements.Element_Access (To))); 332 end Set_In_Structured_Node; 333 334 ------------------ 335 -- Get_Incoming -- 336 ------------------ 337 338 overriding function Get_Incoming 339 (Self : not null access constant UML_Data_Store_Node_Proxy) 340 return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is 341 begin 342 return 343 AMF.UML.Activity_Edges.Collections.Wrap 344 (AMF.Internals.Element_Collections.Wrap 345 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Incoming 346 (Self.Element))); 347 end Get_Incoming; 348 349 ------------------ 350 -- Get_Outgoing -- 351 ------------------ 352 353 overriding function Get_Outgoing 354 (Self : not null access constant UML_Data_Store_Node_Proxy) 355 return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is 356 begin 357 return 358 AMF.UML.Activity_Edges.Collections.Wrap 359 (AMF.Internals.Element_Collections.Wrap 360 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Outgoing 361 (Self.Element))); 362 end Get_Outgoing; 363 364 ------------------------ 365 -- Get_Redefined_Node -- 366 ------------------------ 367 368 overriding function Get_Redefined_Node 369 (Self : not null access constant UML_Data_Store_Node_Proxy) 370 return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is 371 begin 372 return 373 AMF.UML.Activity_Nodes.Collections.Wrap 374 (AMF.Internals.Element_Collections.Wrap 375 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Node 376 (Self.Element))); 377 end Get_Redefined_Node; 378 379 ----------------- 380 -- Get_Is_Leaf -- 381 ----------------- 382 383 overriding function Get_Is_Leaf 384 (Self : not null access constant UML_Data_Store_Node_Proxy) 385 return Boolean is 386 begin 387 return 388 AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf 389 (Self.Element); 390 end Get_Is_Leaf; 391 392 ----------------- 393 -- Set_Is_Leaf -- 394 ----------------- 395 396 overriding procedure Set_Is_Leaf 397 (Self : not null access UML_Data_Store_Node_Proxy; 398 To : Boolean) is 399 begin 400 AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf 401 (Self.Element, To); 402 end Set_Is_Leaf; 403 404 --------------------------- 405 -- Get_Redefined_Element -- 406 --------------------------- 407 408 overriding function Get_Redefined_Element 409 (Self : not null access constant UML_Data_Store_Node_Proxy) 410 return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is 411 begin 412 return 413 AMF.UML.Redefinable_Elements.Collections.Wrap 414 (AMF.Internals.Element_Collections.Wrap 415 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element 416 (Self.Element))); 417 end Get_Redefined_Element; 418 419 ------------------------------ 420 -- Get_Redefinition_Context -- 421 ------------------------------ 422 423 overriding function Get_Redefinition_Context 424 (Self : not null access constant UML_Data_Store_Node_Proxy) 425 return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is 426 begin 427 return 428 AMF.UML.Classifiers.Collections.Wrap 429 (AMF.Internals.Element_Collections.Wrap 430 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context 431 (Self.Element))); 432 end Get_Redefinition_Context; 433 434 --------------------------- 435 -- Get_Client_Dependency -- 436 --------------------------- 437 438 overriding function Get_Client_Dependency 439 (Self : not null access constant UML_Data_Store_Node_Proxy) 440 return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is 441 begin 442 return 443 AMF.UML.Dependencies.Collections.Wrap 444 (AMF.Internals.Element_Collections.Wrap 445 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency 446 (Self.Element))); 447 end Get_Client_Dependency; 448 449 ------------------------- 450 -- Get_Name_Expression -- 451 ------------------------- 452 453 overriding function Get_Name_Expression 454 (Self : not null access constant UML_Data_Store_Node_Proxy) 455 return AMF.UML.String_Expressions.UML_String_Expression_Access is 456 begin 457 return 458 AMF.UML.String_Expressions.UML_String_Expression_Access 459 (AMF.Internals.Helpers.To_Element 460 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression 461 (Self.Element))); 462 end Get_Name_Expression; 463 464 ------------------------- 465 -- Set_Name_Expression -- 466 ------------------------- 467 468 overriding procedure Set_Name_Expression 469 (Self : not null access UML_Data_Store_Node_Proxy; 470 To : AMF.UML.String_Expressions.UML_String_Expression_Access) is 471 begin 472 AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression 473 (Self.Element, 474 AMF.Internals.Helpers.To_Element 475 (AMF.Elements.Element_Access (To))); 476 end Set_Name_Expression; 477 478 ------------------- 479 -- Get_Namespace -- 480 ------------------- 481 482 overriding function Get_Namespace 483 (Self : not null access constant UML_Data_Store_Node_Proxy) 484 return AMF.UML.Namespaces.UML_Namespace_Access is 485 begin 486 return 487 AMF.UML.Namespaces.UML_Namespace_Access 488 (AMF.Internals.Helpers.To_Element 489 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace 490 (Self.Element))); 491 end Get_Namespace; 492 493 ------------------------ 494 -- Get_Qualified_Name -- 495 ------------------------ 496 497 overriding function Get_Qualified_Name 498 (Self : not null access constant UML_Data_Store_Node_Proxy) 499 return AMF.Optional_String is 500 begin 501 declare 502 use type Matreshka.Internals.Strings.Shared_String_Access; 503 504 Aux : constant Matreshka.Internals.Strings.Shared_String_Access 505 := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element); 506 507 begin 508 if Aux = null then 509 return (Is_Empty => True); 510 511 else 512 return (False, League.Strings.Internals.Create (Aux)); 513 end if; 514 end; 515 end Get_Qualified_Name; 516 517 -------------- 518 -- Get_Type -- 519 -------------- 520 521 overriding function Get_Type 522 (Self : not null access constant UML_Data_Store_Node_Proxy) 523 return AMF.UML.Types.UML_Type_Access is 524 begin 525 return 526 AMF.UML.Types.UML_Type_Access 527 (AMF.Internals.Helpers.To_Element 528 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Type 529 (Self.Element))); 530 end Get_Type; 531 532 -------------- 533 -- Set_Type -- 534 -------------- 535 536 overriding procedure Set_Type 537 (Self : not null access UML_Data_Store_Node_Proxy; 538 To : AMF.UML.Types.UML_Type_Access) is 539 begin 540 AMF.Internals.Tables.UML_Attributes.Internal_Set_Type 541 (Self.Element, 542 AMF.Internals.Helpers.To_Element 543 (AMF.Elements.Element_Access (To))); 544 end Set_Type; 545 546 ------------------------ 547 -- Is_Consistent_With -- 548 ------------------------ 549 550 overriding function Is_Consistent_With 551 (Self : not null access constant UML_Data_Store_Node_Proxy; 552 Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) 553 return Boolean is 554 begin 555 -- Generated stub: replace with real body! 556 pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented"); 557 raise Program_Error with "Unimplemented procedure UML_Data_Store_Node_Proxy.Is_Consistent_With"; 558 return Is_Consistent_With (Self, Redefinee); 559 end Is_Consistent_With; 560 561 ----------------------------------- 562 -- Is_Redefinition_Context_Valid -- 563 ----------------------------------- 564 565 overriding function Is_Redefinition_Context_Valid 566 (Self : not null access constant UML_Data_Store_Node_Proxy; 567 Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) 568 return Boolean is 569 begin 570 -- Generated stub: replace with real body! 571 pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented"); 572 raise Program_Error with "Unimplemented procedure UML_Data_Store_Node_Proxy.Is_Redefinition_Context_Valid"; 573 return Is_Redefinition_Context_Valid (Self, Redefined); 574 end Is_Redefinition_Context_Valid; 575 576 ------------------------- 577 -- All_Owning_Packages -- 578 ------------------------- 579 580 overriding function All_Owning_Packages 581 (Self : not null access constant UML_Data_Store_Node_Proxy) 582 return AMF.UML.Packages.Collections.Set_Of_UML_Package is 583 begin 584 -- Generated stub: replace with real body! 585 pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); 586 raise Program_Error with "Unimplemented procedure UML_Data_Store_Node_Proxy.All_Owning_Packages"; 587 return All_Owning_Packages (Self); 588 end All_Owning_Packages; 589 590 ----------------------------- 591 -- Is_Distinguishable_From -- 592 ----------------------------- 593 594 overriding function Is_Distinguishable_From 595 (Self : not null access constant UML_Data_Store_Node_Proxy; 596 N : AMF.UML.Named_Elements.UML_Named_Element_Access; 597 Ns : AMF.UML.Namespaces.UML_Namespace_Access) 598 return Boolean is 599 begin 600 -- Generated stub: replace with real body! 601 pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); 602 raise Program_Error with "Unimplemented procedure UML_Data_Store_Node_Proxy.Is_Distinguishable_From"; 603 return Is_Distinguishable_From (Self, N, Ns); 604 end Is_Distinguishable_From; 605 606 --------------- 607 -- Namespace -- 608 --------------- 609 610 overriding function Namespace 611 (Self : not null access constant UML_Data_Store_Node_Proxy) 612 return AMF.UML.Namespaces.UML_Namespace_Access is 613 begin 614 -- Generated stub: replace with real body! 615 pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); 616 raise Program_Error with "Unimplemented procedure UML_Data_Store_Node_Proxy.Namespace"; 617 return Namespace (Self); 618 end Namespace; 619 620end AMF.Internals.UML_Data_Store_Nodes; 621