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_Connectors is 54 55 ------------------- 56 -- Enter_Element -- 57 ------------------- 58 59 overriding procedure Enter_Element 60 (Self : not null access constant UML_Connector_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_Connector 67 (AMF.UML.Connectors.UML_Connector_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_Connector_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_Connector 84 (AMF.UML.Connectors.UML_Connector_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_Connector_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_Connector 102 (Visitor, 103 AMF.UML.Connectors.UML_Connector_Access (Self), 104 Control); 105 end if; 106 end Visit_Element; 107 108 ------------------ 109 -- Get_Contract -- 110 ------------------ 111 112 overriding function Get_Contract 113 (Self : not null access constant UML_Connector_Proxy) 114 return AMF.UML.Behaviors.Collections.Set_Of_UML_Behavior is 115 begin 116 return 117 AMF.UML.Behaviors.Collections.Wrap 118 (AMF.Internals.Element_Collections.Wrap 119 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Contract 120 (Self.Element))); 121 end Get_Contract; 122 123 ------------- 124 -- Get_End -- 125 ------------- 126 127 overriding function Get_End 128 (Self : not null access constant UML_Connector_Proxy) 129 return AMF.UML.Connector_Ends.Collections.Ordered_Set_Of_UML_Connector_End is 130 begin 131 return 132 AMF.UML.Connector_Ends.Collections.Wrap 133 (AMF.Internals.Element_Collections.Wrap 134 (AMF.Internals.Tables.UML_Attributes.Internal_Get_End 135 (Self.Element))); 136 end Get_End; 137 138 -------------- 139 -- Get_Kind -- 140 -------------- 141 142 overriding function Get_Kind 143 (Self : not null access constant UML_Connector_Proxy) 144 return AMF.UML.UML_Connector_Kind is 145 begin 146 return 147 AMF.Internals.Tables.UML_Attributes.Internal_Get_Kind 148 (Self.Element); 149 end Get_Kind; 150 151 ----------------------------- 152 -- Get_Redefined_Connector -- 153 ----------------------------- 154 155 overriding function Get_Redefined_Connector 156 (Self : not null access constant UML_Connector_Proxy) 157 return AMF.UML.Connectors.Collections.Set_Of_UML_Connector is 158 begin 159 return 160 AMF.UML.Connectors.Collections.Wrap 161 (AMF.Internals.Element_Collections.Wrap 162 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Connector 163 (Self.Element))); 164 end Get_Redefined_Connector; 165 166 -------------- 167 -- Get_Type -- 168 -------------- 169 170 overriding function Get_Type 171 (Self : not null access constant UML_Connector_Proxy) 172 return AMF.UML.Associations.UML_Association_Access is 173 begin 174 return 175 AMF.UML.Associations.UML_Association_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_Connector_Proxy; 187 To : AMF.UML.Associations.UML_Association_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_Featuring_Classifier -- 197 ------------------------------ 198 199 overriding function Get_Featuring_Classifier 200 (Self : not null access constant UML_Connector_Proxy) 201 return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is 202 begin 203 return 204 AMF.UML.Classifiers.Collections.Wrap 205 (AMF.Internals.Element_Collections.Wrap 206 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Featuring_Classifier 207 (Self.Element))); 208 end Get_Featuring_Classifier; 209 210 ------------------- 211 -- Get_Is_Static -- 212 ------------------- 213 214 overriding function Get_Is_Static 215 (Self : not null access constant UML_Connector_Proxy) 216 return Boolean is 217 begin 218 return 219 AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Static 220 (Self.Element); 221 end Get_Is_Static; 222 223 ------------------- 224 -- Set_Is_Static -- 225 ------------------- 226 227 overriding procedure Set_Is_Static 228 (Self : not null access UML_Connector_Proxy; 229 To : Boolean) is 230 begin 231 AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Static 232 (Self.Element, To); 233 end Set_Is_Static; 234 235 ----------------- 236 -- Get_Is_Leaf -- 237 ----------------- 238 239 overriding function Get_Is_Leaf 240 (Self : not null access constant UML_Connector_Proxy) 241 return Boolean is 242 begin 243 return 244 AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf 245 (Self.Element); 246 end Get_Is_Leaf; 247 248 ----------------- 249 -- Set_Is_Leaf -- 250 ----------------- 251 252 overriding procedure Set_Is_Leaf 253 (Self : not null access UML_Connector_Proxy; 254 To : Boolean) is 255 begin 256 AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf 257 (Self.Element, To); 258 end Set_Is_Leaf; 259 260 --------------------------- 261 -- Get_Redefined_Element -- 262 --------------------------- 263 264 overriding function Get_Redefined_Element 265 (Self : not null access constant UML_Connector_Proxy) 266 return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is 267 begin 268 return 269 AMF.UML.Redefinable_Elements.Collections.Wrap 270 (AMF.Internals.Element_Collections.Wrap 271 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element 272 (Self.Element))); 273 end Get_Redefined_Element; 274 275 ------------------------------ 276 -- Get_Redefinition_Context -- 277 ------------------------------ 278 279 overriding function Get_Redefinition_Context 280 (Self : not null access constant UML_Connector_Proxy) 281 return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is 282 begin 283 return 284 AMF.UML.Classifiers.Collections.Wrap 285 (AMF.Internals.Element_Collections.Wrap 286 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context 287 (Self.Element))); 288 end Get_Redefinition_Context; 289 290 --------------------------- 291 -- Get_Client_Dependency -- 292 --------------------------- 293 294 overriding function Get_Client_Dependency 295 (Self : not null access constant UML_Connector_Proxy) 296 return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is 297 begin 298 return 299 AMF.UML.Dependencies.Collections.Wrap 300 (AMF.Internals.Element_Collections.Wrap 301 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency 302 (Self.Element))); 303 end Get_Client_Dependency; 304 305 ------------------------- 306 -- Get_Name_Expression -- 307 ------------------------- 308 309 overriding function Get_Name_Expression 310 (Self : not null access constant UML_Connector_Proxy) 311 return AMF.UML.String_Expressions.UML_String_Expression_Access is 312 begin 313 return 314 AMF.UML.String_Expressions.UML_String_Expression_Access 315 (AMF.Internals.Helpers.To_Element 316 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression 317 (Self.Element))); 318 end Get_Name_Expression; 319 320 ------------------------- 321 -- Set_Name_Expression -- 322 ------------------------- 323 324 overriding procedure Set_Name_Expression 325 (Self : not null access UML_Connector_Proxy; 326 To : AMF.UML.String_Expressions.UML_String_Expression_Access) is 327 begin 328 AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression 329 (Self.Element, 330 AMF.Internals.Helpers.To_Element 331 (AMF.Elements.Element_Access (To))); 332 end Set_Name_Expression; 333 334 ------------------- 335 -- Get_Namespace -- 336 ------------------- 337 338 overriding function Get_Namespace 339 (Self : not null access constant UML_Connector_Proxy) 340 return AMF.UML.Namespaces.UML_Namespace_Access is 341 begin 342 return 343 AMF.UML.Namespaces.UML_Namespace_Access 344 (AMF.Internals.Helpers.To_Element 345 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace 346 (Self.Element))); 347 end Get_Namespace; 348 349 ------------------------ 350 -- Get_Qualified_Name -- 351 ------------------------ 352 353 overriding function Get_Qualified_Name 354 (Self : not null access constant UML_Connector_Proxy) 355 return AMF.Optional_String is 356 begin 357 declare 358 use type Matreshka.Internals.Strings.Shared_String_Access; 359 360 Aux : constant Matreshka.Internals.Strings.Shared_String_Access 361 := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element); 362 363 begin 364 if Aux = null then 365 return (Is_Empty => True); 366 367 else 368 return (False, League.Strings.Internals.Create (Aux)); 369 end if; 370 end; 371 end Get_Qualified_Name; 372 373 ---------- 374 -- Kind -- 375 ---------- 376 377 overriding function Kind 378 (Self : not null access constant UML_Connector_Proxy) 379 return AMF.UML.UML_Connector_Kind is 380 begin 381 -- Generated stub: replace with real body! 382 pragma Compile_Time_Warning (Standard.True, "Kind unimplemented"); 383 raise Program_Error with "Unimplemented procedure UML_Connector_Proxy.Kind"; 384 return Kind (Self); 385 end Kind; 386 387 ------------------------ 388 -- Is_Consistent_With -- 389 ------------------------ 390 391 overriding function Is_Consistent_With 392 (Self : not null access constant UML_Connector_Proxy; 393 Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) 394 return Boolean is 395 begin 396 -- Generated stub: replace with real body! 397 pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented"); 398 raise Program_Error with "Unimplemented procedure UML_Connector_Proxy.Is_Consistent_With"; 399 return Is_Consistent_With (Self, Redefinee); 400 end Is_Consistent_With; 401 402 ----------------------------------- 403 -- Is_Redefinition_Context_Valid -- 404 ----------------------------------- 405 406 overriding function Is_Redefinition_Context_Valid 407 (Self : not null access constant UML_Connector_Proxy; 408 Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) 409 return Boolean is 410 begin 411 -- Generated stub: replace with real body! 412 pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented"); 413 raise Program_Error with "Unimplemented procedure UML_Connector_Proxy.Is_Redefinition_Context_Valid"; 414 return Is_Redefinition_Context_Valid (Self, Redefined); 415 end Is_Redefinition_Context_Valid; 416 417 ------------------------- 418 -- All_Owning_Packages -- 419 ------------------------- 420 421 overriding function All_Owning_Packages 422 (Self : not null access constant UML_Connector_Proxy) 423 return AMF.UML.Packages.Collections.Set_Of_UML_Package is 424 begin 425 -- Generated stub: replace with real body! 426 pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); 427 raise Program_Error with "Unimplemented procedure UML_Connector_Proxy.All_Owning_Packages"; 428 return All_Owning_Packages (Self); 429 end All_Owning_Packages; 430 431 ----------------------------- 432 -- Is_Distinguishable_From -- 433 ----------------------------- 434 435 overriding function Is_Distinguishable_From 436 (Self : not null access constant UML_Connector_Proxy; 437 N : AMF.UML.Named_Elements.UML_Named_Element_Access; 438 Ns : AMF.UML.Namespaces.UML_Namespace_Access) 439 return Boolean is 440 begin 441 -- Generated stub: replace with real body! 442 pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); 443 raise Program_Error with "Unimplemented procedure UML_Connector_Proxy.Is_Distinguishable_From"; 444 return Is_Distinguishable_From (Self, N, Ns); 445 end Is_Distinguishable_From; 446 447 --------------- 448 -- Namespace -- 449 --------------- 450 451 overriding function Namespace 452 (Self : not null access constant UML_Connector_Proxy) 453 return AMF.UML.Namespaces.UML_Namespace_Access is 454 begin 455 -- Generated stub: replace with real body! 456 pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); 457 raise Program_Error with "Unimplemented procedure UML_Connector_Proxy.Namespace"; 458 return Namespace (Self); 459 end Namespace; 460 461end AMF.Internals.UML_Connectors; 462