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_Component_Realizations is 54 55 ------------------- 56 -- Enter_Element -- 57 ------------------- 58 59 overriding procedure Enter_Element 60 (Self : not null access constant UML_Component_Realization_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_Component_Realization 67 (AMF.UML.Component_Realizations.UML_Component_Realization_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_Component_Realization_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_Component_Realization 84 (AMF.UML.Component_Realizations.UML_Component_Realization_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_Component_Realization_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_Component_Realization 102 (Visitor, 103 AMF.UML.Component_Realizations.UML_Component_Realization_Access (Self), 104 Control); 105 end if; 106 end Visit_Element; 107 108 --------------------- 109 -- Get_Abstraction -- 110 --------------------- 111 112 overriding function Get_Abstraction 113 (Self : not null access constant UML_Component_Realization_Proxy) 114 return AMF.UML.Components.UML_Component_Access is 115 begin 116 return 117 AMF.UML.Components.UML_Component_Access 118 (AMF.Internals.Helpers.To_Element 119 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Abstraction 120 (Self.Element))); 121 end Get_Abstraction; 122 123 --------------------- 124 -- Set_Abstraction -- 125 --------------------- 126 127 overriding procedure Set_Abstraction 128 (Self : not null access UML_Component_Realization_Proxy; 129 To : AMF.UML.Components.UML_Component_Access) is 130 begin 131 AMF.Internals.Tables.UML_Attributes.Internal_Set_Abstraction 132 (Self.Element, 133 AMF.Internals.Helpers.To_Element 134 (AMF.Elements.Element_Access (To))); 135 end Set_Abstraction; 136 137 ------------------------------ 138 -- Get_Realizing_Classifier -- 139 ------------------------------ 140 141 overriding function Get_Realizing_Classifier 142 (Self : not null access constant UML_Component_Realization_Proxy) 143 return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is 144 begin 145 return 146 AMF.UML.Classifiers.Collections.Wrap 147 (AMF.Internals.Element_Collections.Wrap 148 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Realizing_Classifier 149 (Self.Element))); 150 end Get_Realizing_Classifier; 151 152 ----------------- 153 -- Get_Mapping -- 154 ----------------- 155 156 overriding function Get_Mapping 157 (Self : not null access constant UML_Component_Realization_Proxy) 158 return AMF.UML.Opaque_Expressions.UML_Opaque_Expression_Access is 159 begin 160 return 161 AMF.UML.Opaque_Expressions.UML_Opaque_Expression_Access 162 (AMF.Internals.Helpers.To_Element 163 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Mapping 164 (Self.Element))); 165 end Get_Mapping; 166 167 ----------------- 168 -- Set_Mapping -- 169 ----------------- 170 171 overriding procedure Set_Mapping 172 (Self : not null access UML_Component_Realization_Proxy; 173 To : AMF.UML.Opaque_Expressions.UML_Opaque_Expression_Access) is 174 begin 175 AMF.Internals.Tables.UML_Attributes.Internal_Set_Mapping 176 (Self.Element, 177 AMF.Internals.Helpers.To_Element 178 (AMF.Elements.Element_Access (To))); 179 end Set_Mapping; 180 181 ---------------- 182 -- Get_Client -- 183 ---------------- 184 185 overriding function Get_Client 186 (Self : not null access constant UML_Component_Realization_Proxy) 187 return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is 188 begin 189 return 190 AMF.UML.Named_Elements.Collections.Wrap 191 (AMF.Internals.Element_Collections.Wrap 192 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client 193 (Self.Element))); 194 end Get_Client; 195 196 ------------------ 197 -- Get_Supplier -- 198 ------------------ 199 200 overriding function Get_Supplier 201 (Self : not null access constant UML_Component_Realization_Proxy) 202 return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is 203 begin 204 return 205 AMF.UML.Named_Elements.Collections.Wrap 206 (AMF.Internals.Element_Collections.Wrap 207 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Supplier 208 (Self.Element))); 209 end Get_Supplier; 210 211 ---------------- 212 -- Get_Source -- 213 ---------------- 214 215 overriding function Get_Source 216 (Self : not null access constant UML_Component_Realization_Proxy) 217 return AMF.UML.Elements.Collections.Set_Of_UML_Element is 218 begin 219 return 220 AMF.UML.Elements.Collections.Wrap 221 (AMF.Internals.Element_Collections.Wrap 222 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Source 223 (Self.Element))); 224 end Get_Source; 225 226 ---------------- 227 -- Get_Target -- 228 ---------------- 229 230 overriding function Get_Target 231 (Self : not null access constant UML_Component_Realization_Proxy) 232 return AMF.UML.Elements.Collections.Set_Of_UML_Element is 233 begin 234 return 235 AMF.UML.Elements.Collections.Wrap 236 (AMF.Internals.Element_Collections.Wrap 237 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Target 238 (Self.Element))); 239 end Get_Target; 240 241 ------------------------- 242 -- Get_Related_Element -- 243 ------------------------- 244 245 overriding function Get_Related_Element 246 (Self : not null access constant UML_Component_Realization_Proxy) 247 return AMF.UML.Elements.Collections.Set_Of_UML_Element is 248 begin 249 return 250 AMF.UML.Elements.Collections.Wrap 251 (AMF.Internals.Element_Collections.Wrap 252 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Related_Element 253 (Self.Element))); 254 end Get_Related_Element; 255 256 --------------------------- 257 -- Get_Client_Dependency -- 258 --------------------------- 259 260 overriding function Get_Client_Dependency 261 (Self : not null access constant UML_Component_Realization_Proxy) 262 return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is 263 begin 264 return 265 AMF.UML.Dependencies.Collections.Wrap 266 (AMF.Internals.Element_Collections.Wrap 267 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency 268 (Self.Element))); 269 end Get_Client_Dependency; 270 271 ------------------------- 272 -- Get_Name_Expression -- 273 ------------------------- 274 275 overriding function Get_Name_Expression 276 (Self : not null access constant UML_Component_Realization_Proxy) 277 return AMF.UML.String_Expressions.UML_String_Expression_Access is 278 begin 279 return 280 AMF.UML.String_Expressions.UML_String_Expression_Access 281 (AMF.Internals.Helpers.To_Element 282 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression 283 (Self.Element))); 284 end Get_Name_Expression; 285 286 ------------------------- 287 -- Set_Name_Expression -- 288 ------------------------- 289 290 overriding procedure Set_Name_Expression 291 (Self : not null access UML_Component_Realization_Proxy; 292 To : AMF.UML.String_Expressions.UML_String_Expression_Access) is 293 begin 294 AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression 295 (Self.Element, 296 AMF.Internals.Helpers.To_Element 297 (AMF.Elements.Element_Access (To))); 298 end Set_Name_Expression; 299 300 ------------------- 301 -- Get_Namespace -- 302 ------------------- 303 304 overriding function Get_Namespace 305 (Self : not null access constant UML_Component_Realization_Proxy) 306 return AMF.UML.Namespaces.UML_Namespace_Access is 307 begin 308 return 309 AMF.UML.Namespaces.UML_Namespace_Access 310 (AMF.Internals.Helpers.To_Element 311 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace 312 (Self.Element))); 313 end Get_Namespace; 314 315 ------------------------ 316 -- Get_Qualified_Name -- 317 ------------------------ 318 319 overriding function Get_Qualified_Name 320 (Self : not null access constant UML_Component_Realization_Proxy) 321 return AMF.Optional_String is 322 begin 323 declare 324 use type Matreshka.Internals.Strings.Shared_String_Access; 325 326 Aux : constant Matreshka.Internals.Strings.Shared_String_Access 327 := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element); 328 329 begin 330 if Aux = null then 331 return (Is_Empty => True); 332 333 else 334 return (False, League.Strings.Internals.Create (Aux)); 335 end if; 336 end; 337 end Get_Qualified_Name; 338 339 ----------------------------------- 340 -- Get_Owning_Template_Parameter -- 341 ----------------------------------- 342 343 overriding function Get_Owning_Template_Parameter 344 (Self : not null access constant UML_Component_Realization_Proxy) 345 return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is 346 begin 347 return 348 AMF.UML.Template_Parameters.UML_Template_Parameter_Access 349 (AMF.Internals.Helpers.To_Element 350 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter 351 (Self.Element))); 352 end Get_Owning_Template_Parameter; 353 354 ----------------------------------- 355 -- Set_Owning_Template_Parameter -- 356 ----------------------------------- 357 358 overriding procedure Set_Owning_Template_Parameter 359 (Self : not null access UML_Component_Realization_Proxy; 360 To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is 361 begin 362 AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter 363 (Self.Element, 364 AMF.Internals.Helpers.To_Element 365 (AMF.Elements.Element_Access (To))); 366 end Set_Owning_Template_Parameter; 367 368 ---------------------------- 369 -- Get_Template_Parameter -- 370 ---------------------------- 371 372 overriding function Get_Template_Parameter 373 (Self : not null access constant UML_Component_Realization_Proxy) 374 return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is 375 begin 376 return 377 AMF.UML.Template_Parameters.UML_Template_Parameter_Access 378 (AMF.Internals.Helpers.To_Element 379 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter 380 (Self.Element))); 381 end Get_Template_Parameter; 382 383 ---------------------------- 384 -- Set_Template_Parameter -- 385 ---------------------------- 386 387 overriding procedure Set_Template_Parameter 388 (Self : not null access UML_Component_Realization_Proxy; 389 To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is 390 begin 391 AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter 392 (Self.Element, 393 AMF.Internals.Helpers.To_Element 394 (AMF.Elements.Element_Access (To))); 395 end Set_Template_Parameter; 396 397 ------------------------- 398 -- All_Owning_Packages -- 399 ------------------------- 400 401 overriding function All_Owning_Packages 402 (Self : not null access constant UML_Component_Realization_Proxy) 403 return AMF.UML.Packages.Collections.Set_Of_UML_Package is 404 begin 405 -- Generated stub: replace with real body! 406 pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); 407 raise Program_Error with "Unimplemented procedure UML_Component_Realization_Proxy.All_Owning_Packages"; 408 return All_Owning_Packages (Self); 409 end All_Owning_Packages; 410 411 ----------------------------- 412 -- Is_Distinguishable_From -- 413 ----------------------------- 414 415 overriding function Is_Distinguishable_From 416 (Self : not null access constant UML_Component_Realization_Proxy; 417 N : AMF.UML.Named_Elements.UML_Named_Element_Access; 418 Ns : AMF.UML.Namespaces.UML_Namespace_Access) 419 return Boolean is 420 begin 421 -- Generated stub: replace with real body! 422 pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); 423 raise Program_Error with "Unimplemented procedure UML_Component_Realization_Proxy.Is_Distinguishable_From"; 424 return Is_Distinguishable_From (Self, N, Ns); 425 end Is_Distinguishable_From; 426 427 --------------- 428 -- Namespace -- 429 --------------- 430 431 overriding function Namespace 432 (Self : not null access constant UML_Component_Realization_Proxy) 433 return AMF.UML.Namespaces.UML_Namespace_Access is 434 begin 435 -- Generated stub: replace with real body! 436 pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); 437 raise Program_Error with "Unimplemented procedure UML_Component_Realization_Proxy.Namespace"; 438 return Namespace (Self); 439 end Namespace; 440 441 ------------------------ 442 -- Is_Compatible_With -- 443 ------------------------ 444 445 overriding function Is_Compatible_With 446 (Self : not null access constant UML_Component_Realization_Proxy; 447 P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) 448 return Boolean is 449 begin 450 -- Generated stub: replace with real body! 451 pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented"); 452 raise Program_Error with "Unimplemented procedure UML_Component_Realization_Proxy.Is_Compatible_With"; 453 return Is_Compatible_With (Self, P); 454 end Is_Compatible_With; 455 456 --------------------------- 457 -- Is_Template_Parameter -- 458 --------------------------- 459 460 overriding function Is_Template_Parameter 461 (Self : not null access constant UML_Component_Realization_Proxy) 462 return Boolean is 463 begin 464 -- Generated stub: replace with real body! 465 pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented"); 466 raise Program_Error with "Unimplemented procedure UML_Component_Realization_Proxy.Is_Template_Parameter"; 467 return Is_Template_Parameter (Self); 468 end Is_Template_Parameter; 469 470end AMF.Internals.UML_Component_Realizations; 471