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: 2967 $ $Date: 2012-05-12 10:21:56 +0400 (Sat, 12 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_Variables is 54 55 ------------------- 56 -- Enter_Element -- 57 ------------------- 58 59 overriding procedure Enter_Element 60 (Self : not null access constant UML_Variable_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_Variable 67 (AMF.UML.Variables.UML_Variable_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_Variable_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_Variable 84 (AMF.UML.Variables.UML_Variable_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_Variable_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_Variable 102 (Visitor, 103 AMF.UML.Variables.UML_Variable_Access (Self), 104 Control); 105 end if; 106 end Visit_Element; 107 108 ------------------------ 109 -- Get_Activity_Scope -- 110 ------------------------ 111 112 overriding function Get_Activity_Scope 113 (Self : not null access constant UML_Variable_Proxy) 114 return AMF.UML.Activities.UML_Activity_Access is 115 begin 116 return 117 AMF.UML.Activities.UML_Activity_Access 118 (AMF.Internals.Helpers.To_Element 119 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Activity_Scope 120 (Self.Element))); 121 end Get_Activity_Scope; 122 123 ------------------------ 124 -- Set_Activity_Scope -- 125 ------------------------ 126 127 overriding procedure Set_Activity_Scope 128 (Self : not null access UML_Variable_Proxy; 129 To : AMF.UML.Activities.UML_Activity_Access) is 130 begin 131 AMF.Internals.Tables.UML_Attributes.Internal_Set_Activity_Scope 132 (Self.Element, 133 AMF.Internals.Helpers.To_Element 134 (AMF.Elements.Element_Access (To))); 135 end Set_Activity_Scope; 136 137 --------------- 138 -- Get_Scope -- 139 --------------- 140 141 overriding function Get_Scope 142 (Self : not null access constant UML_Variable_Proxy) 143 return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access is 144 begin 145 return 146 AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access 147 (AMF.Internals.Helpers.To_Element 148 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Scope 149 (Self.Element))); 150 end Get_Scope; 151 152 --------------- 153 -- Set_Scope -- 154 --------------- 155 156 overriding procedure Set_Scope 157 (Self : not null access UML_Variable_Proxy; 158 To : AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access) is 159 begin 160 AMF.Internals.Tables.UML_Attributes.Internal_Set_Scope 161 (Self.Element, 162 AMF.Internals.Helpers.To_Element 163 (AMF.Elements.Element_Access (To))); 164 end Set_Scope; 165 166 ------------- 167 -- Get_End -- 168 ------------- 169 170 overriding function Get_End 171 (Self : not null access constant UML_Variable_Proxy) 172 return AMF.UML.Connector_Ends.Collections.Ordered_Set_Of_UML_Connector_End is 173 begin 174 return 175 AMF.UML.Connector_Ends.Collections.Wrap 176 (AMF.Internals.Element_Collections.Wrap 177 (AMF.Internals.Tables.UML_Attributes.Internal_Get_End 178 (Self.Element))); 179 end Get_End; 180 181 ---------------------------- 182 -- Get_Template_Parameter -- 183 ---------------------------- 184 185 overriding function Get_Template_Parameter 186 (Self : not null access constant UML_Variable_Proxy) 187 return AMF.UML.Connectable_Element_Template_Parameters.UML_Connectable_Element_Template_Parameter_Access is 188 begin 189 return 190 AMF.UML.Connectable_Element_Template_Parameters.UML_Connectable_Element_Template_Parameter_Access 191 (AMF.Internals.Helpers.To_Element 192 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter 193 (Self.Element))); 194 end Get_Template_Parameter; 195 196 ---------------------------- 197 -- Set_Template_Parameter -- 198 ---------------------------- 199 200 overriding procedure Set_Template_Parameter 201 (Self : not null access UML_Variable_Proxy; 202 To : AMF.UML.Connectable_Element_Template_Parameters.UML_Connectable_Element_Template_Parameter_Access) is 203 begin 204 AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter 205 (Self.Element, 206 AMF.Internals.Helpers.To_Element 207 (AMF.Elements.Element_Access (To))); 208 end Set_Template_Parameter; 209 210 -------------- 211 -- Get_Type -- 212 -------------- 213 214 overriding function Get_Type 215 (Self : not null access constant UML_Variable_Proxy) 216 return AMF.UML.Types.UML_Type_Access is 217 begin 218 return 219 AMF.UML.Types.UML_Type_Access 220 (AMF.Internals.Helpers.To_Element 221 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Type 222 (Self.Element))); 223 end Get_Type; 224 225 -------------- 226 -- Set_Type -- 227 -------------- 228 229 overriding procedure Set_Type 230 (Self : not null access UML_Variable_Proxy; 231 To : AMF.UML.Types.UML_Type_Access) is 232 begin 233 AMF.Internals.Tables.UML_Attributes.Internal_Set_Type 234 (Self.Element, 235 AMF.Internals.Helpers.To_Element 236 (AMF.Elements.Element_Access (To))); 237 end Set_Type; 238 239 --------------------------- 240 -- Get_Client_Dependency -- 241 --------------------------- 242 243 overriding function Get_Client_Dependency 244 (Self : not null access constant UML_Variable_Proxy) 245 return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is 246 begin 247 return 248 AMF.UML.Dependencies.Collections.Wrap 249 (AMF.Internals.Element_Collections.Wrap 250 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency 251 (Self.Element))); 252 end Get_Client_Dependency; 253 254 ------------------------- 255 -- Get_Name_Expression -- 256 ------------------------- 257 258 overriding function Get_Name_Expression 259 (Self : not null access constant UML_Variable_Proxy) 260 return AMF.UML.String_Expressions.UML_String_Expression_Access is 261 begin 262 return 263 AMF.UML.String_Expressions.UML_String_Expression_Access 264 (AMF.Internals.Helpers.To_Element 265 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression 266 (Self.Element))); 267 end Get_Name_Expression; 268 269 ------------------------- 270 -- Set_Name_Expression -- 271 ------------------------- 272 273 overriding procedure Set_Name_Expression 274 (Self : not null access UML_Variable_Proxy; 275 To : AMF.UML.String_Expressions.UML_String_Expression_Access) is 276 begin 277 AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression 278 (Self.Element, 279 AMF.Internals.Helpers.To_Element 280 (AMF.Elements.Element_Access (To))); 281 end Set_Name_Expression; 282 283 ------------------- 284 -- Get_Namespace -- 285 ------------------- 286 287 overriding function Get_Namespace 288 (Self : not null access constant UML_Variable_Proxy) 289 return AMF.UML.Namespaces.UML_Namespace_Access is 290 begin 291 return 292 AMF.UML.Namespaces.UML_Namespace_Access 293 (AMF.Internals.Helpers.To_Element 294 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace 295 (Self.Element))); 296 end Get_Namespace; 297 298 ------------------------ 299 -- Get_Qualified_Name -- 300 ------------------------ 301 302 overriding function Get_Qualified_Name 303 (Self : not null access constant UML_Variable_Proxy) 304 return AMF.Optional_String is 305 begin 306 declare 307 use type Matreshka.Internals.Strings.Shared_String_Access; 308 309 Aux : constant Matreshka.Internals.Strings.Shared_String_Access 310 := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element); 311 312 begin 313 if Aux = null then 314 return (Is_Empty => True); 315 316 else 317 return (False, League.Strings.Internals.Create (Aux)); 318 end if; 319 end; 320 end Get_Qualified_Name; 321 322 ----------------------------------- 323 -- Get_Owning_Template_Parameter -- 324 ----------------------------------- 325 326 overriding function Get_Owning_Template_Parameter 327 (Self : not null access constant UML_Variable_Proxy) 328 return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is 329 begin 330 return 331 AMF.UML.Template_Parameters.UML_Template_Parameter_Access 332 (AMF.Internals.Helpers.To_Element 333 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter 334 (Self.Element))); 335 end Get_Owning_Template_Parameter; 336 337 ----------------------------------- 338 -- Set_Owning_Template_Parameter -- 339 ----------------------------------- 340 341 overriding procedure Set_Owning_Template_Parameter 342 (Self : not null access UML_Variable_Proxy; 343 To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is 344 begin 345 AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter 346 (Self.Element, 347 AMF.Internals.Helpers.To_Element 348 (AMF.Elements.Element_Access (To))); 349 end Set_Owning_Template_Parameter; 350 351 ---------------------------- 352 -- Get_Template_Parameter -- 353 ---------------------------- 354 355 overriding function Get_Template_Parameter 356 (Self : not null access constant UML_Variable_Proxy) 357 return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is 358 begin 359 return 360 AMF.UML.Template_Parameters.UML_Template_Parameter_Access 361 (AMF.Internals.Helpers.To_Element 362 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter 363 (Self.Element))); 364 end Get_Template_Parameter; 365 366 ---------------------------- 367 -- Set_Template_Parameter -- 368 ---------------------------- 369 370 overriding procedure Set_Template_Parameter 371 (Self : not null access UML_Variable_Proxy; 372 To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is 373 begin 374 AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter 375 (Self.Element, 376 AMF.Internals.Helpers.To_Element 377 (AMF.Elements.Element_Access (To))); 378 end Set_Template_Parameter; 379 380 ---------------------- 381 -- Is_Accessible_By -- 382 ---------------------- 383 384 overriding function Is_Accessible_By 385 (Self : not null access constant UML_Variable_Proxy; 386 A : AMF.UML.Actions.UML_Action_Access) 387 return Boolean is 388 begin 389 -- Generated stub: replace with real body! 390 pragma Compile_Time_Warning (Standard.True, "Is_Accessible_By unimplemented"); 391 raise Program_Error with "Unimplemented procedure UML_Variable_Proxy.Is_Accessible_By"; 392 return Is_Accessible_By (Self, A); 393 end Is_Accessible_By; 394 395 ---------- 396 -- Ends -- 397 ---------- 398 399 overriding function Ends 400 (Self : not null access constant UML_Variable_Proxy) 401 return AMF.UML.Connector_Ends.Collections.Set_Of_UML_Connector_End is 402 begin 403 -- Generated stub: replace with real body! 404 pragma Compile_Time_Warning (Standard.True, "Ends unimplemented"); 405 raise Program_Error with "Unimplemented procedure UML_Variable_Proxy.Ends"; 406 return Ends (Self); 407 end Ends; 408 409 ------------------------- 410 -- All_Owning_Packages -- 411 ------------------------- 412 413 overriding function All_Owning_Packages 414 (Self : not null access constant UML_Variable_Proxy) 415 return AMF.UML.Packages.Collections.Set_Of_UML_Package is 416 begin 417 -- Generated stub: replace with real body! 418 pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); 419 raise Program_Error with "Unimplemented procedure UML_Variable_Proxy.All_Owning_Packages"; 420 return All_Owning_Packages (Self); 421 end All_Owning_Packages; 422 423 ----------------------------- 424 -- Is_Distinguishable_From -- 425 ----------------------------- 426 427 overriding function Is_Distinguishable_From 428 (Self : not null access constant UML_Variable_Proxy; 429 N : AMF.UML.Named_Elements.UML_Named_Element_Access; 430 Ns : AMF.UML.Namespaces.UML_Namespace_Access) 431 return Boolean is 432 begin 433 -- Generated stub: replace with real body! 434 pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); 435 raise Program_Error with "Unimplemented procedure UML_Variable_Proxy.Is_Distinguishable_From"; 436 return Is_Distinguishable_From (Self, N, Ns); 437 end Is_Distinguishable_From; 438 439 --------------- 440 -- Namespace -- 441 --------------- 442 443 overriding function Namespace 444 (Self : not null access constant UML_Variable_Proxy) 445 return AMF.UML.Namespaces.UML_Namespace_Access is 446 begin 447 -- Generated stub: replace with real body! 448 pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); 449 raise Program_Error with "Unimplemented procedure UML_Variable_Proxy.Namespace"; 450 return Namespace (Self); 451 end Namespace; 452 453 ------------------------ 454 -- Is_Compatible_With -- 455 ------------------------ 456 457 overriding function Is_Compatible_With 458 (Self : not null access constant UML_Variable_Proxy; 459 P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) 460 return Boolean is 461 begin 462 -- Generated stub: replace with real body! 463 pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented"); 464 raise Program_Error with "Unimplemented procedure UML_Variable_Proxy.Is_Compatible_With"; 465 return Is_Compatible_With (Self, P); 466 end Is_Compatible_With; 467 468 --------------------------- 469 -- Is_Template_Parameter -- 470 --------------------------- 471 472 overriding function Is_Template_Parameter 473 (Self : not null access constant UML_Variable_Proxy) 474 return Boolean is 475 begin 476 -- Generated stub: replace with real body! 477 pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented"); 478 raise Program_Error with "Unimplemented procedure UML_Variable_Proxy.Is_Template_Parameter"; 479 return Is_Template_Parameter (Self); 480 end Is_Template_Parameter; 481 482 --------------------- 483 -- Compatible_With -- 484 --------------------- 485 486 overriding function Compatible_With 487 (Self : not null access constant UML_Variable_Proxy; 488 Other : AMF.UML.Multiplicity_Elements.UML_Multiplicity_Element_Access) 489 return Boolean is 490 begin 491 -- Generated stub: replace with real body! 492 pragma Compile_Time_Warning (Standard.True, "Compatible_With unimplemented"); 493 raise Program_Error with "Unimplemented procedure UML_Variable_Proxy.Compatible_With"; 494 return Compatible_With (Self, Other); 495 end Compatible_With; 496 497 -------------------------- 498 -- Includes_Cardinality -- 499 -------------------------- 500 501 overriding function Includes_Cardinality 502 (Self : not null access constant UML_Variable_Proxy; 503 C : Integer) 504 return Boolean is 505 begin 506 -- Generated stub: replace with real body! 507 pragma Compile_Time_Warning (Standard.True, "Includes_Cardinality unimplemented"); 508 raise Program_Error with "Unimplemented procedure UML_Variable_Proxy.Includes_Cardinality"; 509 return Includes_Cardinality (Self, C); 510 end Includes_Cardinality; 511 512 --------------------------- 513 -- Includes_Multiplicity -- 514 --------------------------- 515 516 overriding function Includes_Multiplicity 517 (Self : not null access constant UML_Variable_Proxy; 518 M : AMF.UML.Multiplicity_Elements.UML_Multiplicity_Element_Access) 519 return Boolean is 520 begin 521 -- Generated stub: replace with real body! 522 pragma Compile_Time_Warning (Standard.True, "Includes_Multiplicity unimplemented"); 523 raise Program_Error with "Unimplemented procedure UML_Variable_Proxy.Includes_Multiplicity"; 524 return Includes_Multiplicity (Self, M); 525 end Includes_Multiplicity; 526 527 --------- 528 -- Iss -- 529 --------- 530 531 overriding function Iss 532 (Self : not null access constant UML_Variable_Proxy; 533 Lowerbound : Integer; 534 Upperbound : Integer) 535 return Boolean is 536 begin 537 -- Generated stub: replace with real body! 538 pragma Compile_Time_Warning (Standard.True, "Iss unimplemented"); 539 raise Program_Error with "Unimplemented procedure UML_Variable_Proxy.Iss"; 540 return Iss (Self, Lowerbound, Upperbound); 541 end Iss; 542 543end AMF.Internals.UML_Variables; 544