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