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_Includes is 54 55 ------------------- 56 -- Enter_Element -- 57 ------------------- 58 59 overriding procedure Enter_Element 60 (Self : not null access constant UML_Include_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_Include 67 (AMF.UML.Includes.UML_Include_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_Include_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_Include 84 (AMF.UML.Includes.UML_Include_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_Include_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_Include 102 (Visitor, 103 AMF.UML.Includes.UML_Include_Access (Self), 104 Control); 105 end if; 106 end Visit_Element; 107 108 ------------------ 109 -- Get_Addition -- 110 ------------------ 111 112 overriding function Get_Addition 113 (Self : not null access constant UML_Include_Proxy) 114 return AMF.UML.Use_Cases.UML_Use_Case_Access is 115 begin 116 return 117 AMF.UML.Use_Cases.UML_Use_Case_Access 118 (AMF.Internals.Helpers.To_Element 119 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Addition 120 (Self.Element))); 121 end Get_Addition; 122 123 ------------------ 124 -- Set_Addition -- 125 ------------------ 126 127 overriding procedure Set_Addition 128 (Self : not null access UML_Include_Proxy; 129 To : AMF.UML.Use_Cases.UML_Use_Case_Access) is 130 begin 131 AMF.Internals.Tables.UML_Attributes.Internal_Set_Addition 132 (Self.Element, 133 AMF.Internals.Helpers.To_Element 134 (AMF.Elements.Element_Access (To))); 135 end Set_Addition; 136 137 ------------------------ 138 -- Get_Including_Case -- 139 ------------------------ 140 141 overriding function Get_Including_Case 142 (Self : not null access constant UML_Include_Proxy) 143 return AMF.UML.Use_Cases.UML_Use_Case_Access is 144 begin 145 return 146 AMF.UML.Use_Cases.UML_Use_Case_Access 147 (AMF.Internals.Helpers.To_Element 148 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Including_Case 149 (Self.Element))); 150 end Get_Including_Case; 151 152 ------------------------ 153 -- Set_Including_Case -- 154 ------------------------ 155 156 overriding procedure Set_Including_Case 157 (Self : not null access UML_Include_Proxy; 158 To : AMF.UML.Use_Cases.UML_Use_Case_Access) is 159 begin 160 AMF.Internals.Tables.UML_Attributes.Internal_Set_Including_Case 161 (Self.Element, 162 AMF.Internals.Helpers.To_Element 163 (AMF.Elements.Element_Access (To))); 164 end Set_Including_Case; 165 166 ---------------- 167 -- Get_Source -- 168 ---------------- 169 170 overriding function Get_Source 171 (Self : not null access constant UML_Include_Proxy) 172 return AMF.UML.Elements.Collections.Set_Of_UML_Element is 173 begin 174 return 175 AMF.UML.Elements.Collections.Wrap 176 (AMF.Internals.Element_Collections.Wrap 177 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Source 178 (Self.Element))); 179 end Get_Source; 180 181 ---------------- 182 -- Get_Target -- 183 ---------------- 184 185 overriding function Get_Target 186 (Self : not null access constant UML_Include_Proxy) 187 return AMF.UML.Elements.Collections.Set_Of_UML_Element is 188 begin 189 return 190 AMF.UML.Elements.Collections.Wrap 191 (AMF.Internals.Element_Collections.Wrap 192 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Target 193 (Self.Element))); 194 end Get_Target; 195 196 ------------------------- 197 -- Get_Related_Element -- 198 ------------------------- 199 200 overriding function Get_Related_Element 201 (Self : not null access constant UML_Include_Proxy) 202 return AMF.UML.Elements.Collections.Set_Of_UML_Element is 203 begin 204 return 205 AMF.UML.Elements.Collections.Wrap 206 (AMF.Internals.Element_Collections.Wrap 207 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Related_Element 208 (Self.Element))); 209 end Get_Related_Element; 210 211 --------------------------- 212 -- Get_Client_Dependency -- 213 --------------------------- 214 215 overriding function Get_Client_Dependency 216 (Self : not null access constant UML_Include_Proxy) 217 return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is 218 begin 219 return 220 AMF.UML.Dependencies.Collections.Wrap 221 (AMF.Internals.Element_Collections.Wrap 222 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency 223 (Self.Element))); 224 end Get_Client_Dependency; 225 226 ------------------------- 227 -- Get_Name_Expression -- 228 ------------------------- 229 230 overriding function Get_Name_Expression 231 (Self : not null access constant UML_Include_Proxy) 232 return AMF.UML.String_Expressions.UML_String_Expression_Access is 233 begin 234 return 235 AMF.UML.String_Expressions.UML_String_Expression_Access 236 (AMF.Internals.Helpers.To_Element 237 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression 238 (Self.Element))); 239 end Get_Name_Expression; 240 241 ------------------------- 242 -- Set_Name_Expression -- 243 ------------------------- 244 245 overriding procedure Set_Name_Expression 246 (Self : not null access UML_Include_Proxy; 247 To : AMF.UML.String_Expressions.UML_String_Expression_Access) is 248 begin 249 AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression 250 (Self.Element, 251 AMF.Internals.Helpers.To_Element 252 (AMF.Elements.Element_Access (To))); 253 end Set_Name_Expression; 254 255 ------------------- 256 -- Get_Namespace -- 257 ------------------- 258 259 overriding function Get_Namespace 260 (Self : not null access constant UML_Include_Proxy) 261 return AMF.UML.Namespaces.UML_Namespace_Access is 262 begin 263 return 264 AMF.UML.Namespaces.UML_Namespace_Access 265 (AMF.Internals.Helpers.To_Element 266 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace 267 (Self.Element))); 268 end Get_Namespace; 269 270 ------------------------ 271 -- Get_Qualified_Name -- 272 ------------------------ 273 274 overriding function Get_Qualified_Name 275 (Self : not null access constant UML_Include_Proxy) 276 return AMF.Optional_String is 277 begin 278 declare 279 use type Matreshka.Internals.Strings.Shared_String_Access; 280 281 Aux : constant Matreshka.Internals.Strings.Shared_String_Access 282 := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element); 283 284 begin 285 if Aux = null then 286 return (Is_Empty => True); 287 288 else 289 return (False, League.Strings.Internals.Create (Aux)); 290 end if; 291 end; 292 end Get_Qualified_Name; 293 294 ------------------------- 295 -- All_Owning_Packages -- 296 ------------------------- 297 298 overriding function All_Owning_Packages 299 (Self : not null access constant UML_Include_Proxy) 300 return AMF.UML.Packages.Collections.Set_Of_UML_Package is 301 begin 302 -- Generated stub: replace with real body! 303 pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); 304 raise Program_Error with "Unimplemented procedure UML_Include_Proxy.All_Owning_Packages"; 305 return All_Owning_Packages (Self); 306 end All_Owning_Packages; 307 308 ----------------------------- 309 -- Is_Distinguishable_From -- 310 ----------------------------- 311 312 overriding function Is_Distinguishable_From 313 (Self : not null access constant UML_Include_Proxy; 314 N : AMF.UML.Named_Elements.UML_Named_Element_Access; 315 Ns : AMF.UML.Namespaces.UML_Namespace_Access) 316 return Boolean is 317 begin 318 -- Generated stub: replace with real body! 319 pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); 320 raise Program_Error with "Unimplemented procedure UML_Include_Proxy.Is_Distinguishable_From"; 321 return Is_Distinguishable_From (Self, N, Ns); 322 end Is_Distinguishable_From; 323 324 --------------- 325 -- Namespace -- 326 --------------- 327 328 overriding function Namespace 329 (Self : not null access constant UML_Include_Proxy) 330 return AMF.UML.Namespaces.UML_Namespace_Access is 331 begin 332 -- Generated stub: replace with real body! 333 pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); 334 raise Program_Error with "Unimplemented procedure UML_Include_Proxy.Namespace"; 335 return Namespace (Self); 336 end Namespace; 337 338end AMF.Internals.UML_Includes; 339