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