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_Literal_Integers is 54 55 ------------------- 56 -- Enter_Element -- 57 ------------------- 58 59 overriding procedure Enter_Element 60 (Self : not null access constant UML_Literal_Integer_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_Literal_Integer 67 (AMF.UML.Literal_Integers.UML_Literal_Integer_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_Literal_Integer_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_Literal_Integer 84 (AMF.UML.Literal_Integers.UML_Literal_Integer_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_Literal_Integer_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_Literal_Integer 102 (Visitor, 103 AMF.UML.Literal_Integers.UML_Literal_Integer_Access (Self), 104 Control); 105 end if; 106 end Visit_Element; 107 108 --------------------------- 109 -- Get_Client_Dependency -- 110 --------------------------- 111 112 overriding function Get_Client_Dependency 113 (Self : not null access constant UML_Literal_Integer_Proxy) 114 return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is 115 begin 116 return 117 AMF.UML.Dependencies.Collections.Wrap 118 (AMF.Internals.Element_Collections.Wrap 119 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency 120 (Self.Element))); 121 end Get_Client_Dependency; 122 123 ------------------------- 124 -- Get_Name_Expression -- 125 ------------------------- 126 127 overriding function Get_Name_Expression 128 (Self : not null access constant UML_Literal_Integer_Proxy) 129 return AMF.UML.String_Expressions.UML_String_Expression_Access is 130 begin 131 return 132 AMF.UML.String_Expressions.UML_String_Expression_Access 133 (AMF.Internals.Helpers.To_Element 134 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression 135 (Self.Element))); 136 end Get_Name_Expression; 137 138 ------------------- 139 -- Get_Namespace -- 140 ------------------- 141 142 overriding function Get_Namespace 143 (Self : not null access constant UML_Literal_Integer_Proxy) 144 return AMF.UML.Namespaces.UML_Namespace_Access is 145 begin 146 return 147 AMF.UML.Namespaces.UML_Namespace_Access 148 (AMF.Internals.Helpers.To_Element 149 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace 150 (Self.Element))); 151 end Get_Namespace; 152 153 ----------------------------------- 154 -- Get_Owning_Template_Parameter -- 155 ----------------------------------- 156 157 overriding function Get_Owning_Template_Parameter 158 (Self : not null access constant UML_Literal_Integer_Proxy) 159 return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is 160 begin 161 return 162 AMF.UML.Template_Parameters.UML_Template_Parameter_Access 163 (AMF.Internals.Helpers.To_Element 164 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter 165 (Self.Element))); 166 end Get_Owning_Template_Parameter; 167 168 ------------------------ 169 -- Get_Qualified_Name -- 170 ------------------------ 171 172 overriding function Get_Qualified_Name 173 (Self : not null access constant UML_Literal_Integer_Proxy) 174 return AMF.Optional_String is 175 begin 176 declare 177 use type Matreshka.Internals.Strings.Shared_String_Access; 178 179 Aux : constant Matreshka.Internals.Strings.Shared_String_Access 180 := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element); 181 182 begin 183 if Aux = null then 184 return (Is_Empty => True); 185 186 else 187 return (False, League.Strings.Internals.Create (Aux)); 188 end if; 189 end; 190 end Get_Qualified_Name; 191 192 ---------------------------- 193 -- Get_Template_Parameter -- 194 ---------------------------- 195 196 overriding function Get_Template_Parameter 197 (Self : not null access constant UML_Literal_Integer_Proxy) 198 return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is 199 begin 200 return 201 AMF.UML.Template_Parameters.UML_Template_Parameter_Access 202 (AMF.Internals.Helpers.To_Element 203 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter 204 (Self.Element))); 205 end Get_Template_Parameter; 206 207 -------------- 208 -- Get_Type -- 209 -------------- 210 211 overriding function Get_Type 212 (Self : not null access constant UML_Literal_Integer_Proxy) 213 return AMF.UML.Types.UML_Type_Access is 214 begin 215 return 216 AMF.UML.Types.UML_Type_Access 217 (AMF.Internals.Helpers.To_Element 218 (AMF.Internals.Tables.UML_Attributes.Internal_Get_Type 219 (Self.Element))); 220 end Get_Type; 221 222 --------------- 223 -- Get_Value -- 224 --------------- 225 226 overriding function Get_Value 227 (Self : not null access constant UML_Literal_Integer_Proxy) 228 return Integer is 229 begin 230 return 231 AMF.Internals.Tables.UML_Attributes.Internal_Get_Value 232 (Self.Element); 233 end Get_Value; 234 235 ------------------- 236 -- Integer_Value -- 237 ------------------- 238 239 overriding function Integer_Value 240 (Self : not null access constant UML_Literal_Integer_Proxy) 241 return Integer 242 is 243 -- 7.3.27 LiteralInteger (from Kernel) 244 -- 245 -- [2] The query integerValue() gives the value. 246 -- 247 -- LiteralInteger::integerValue() : [Integer]; 248 -- integerValue = value 249 250 begin 251 return UML_Literal_Integer_Proxy'Class (Self.all).Get_Value; 252 end Integer_Value; 253 254 ------------------- 255 -- Integer_Value -- 256 ------------------- 257 258 overriding function Integer_Value 259 (Self : not null access constant UML_Literal_Integer_Proxy) 260 return AMF.Optional_Integer 261 is 262 -- 7.3.27 LiteralInteger (from Kernel) 263 -- 264 -- [2] The query integerValue() gives the value. 265 -- 266 -- LiteralInteger::integerValue() : [Integer]; 267 -- integerValue = value 268 269 begin 270 return (False, UML_Literal_Integer_Proxy'Class (Self.all).Get_Value); 271 end Integer_Value; 272 273 ------------------------- 274 -- Set_Name_Expression -- 275 ------------------------- 276 277 overriding procedure Set_Name_Expression 278 (Self : not null access UML_Literal_Integer_Proxy; 279 To : AMF.UML.String_Expressions.UML_String_Expression_Access) is 280 begin 281 AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression 282 (Self.Element, 283 AMF.Internals.Helpers.To_Element 284 (AMF.Elements.Element_Access (To))); 285 end Set_Name_Expression; 286 287 ----------------------------------- 288 -- Set_Owning_Template_Parameter -- 289 ----------------------------------- 290 291 overriding procedure Set_Owning_Template_Parameter 292 (Self : not null access UML_Literal_Integer_Proxy; 293 To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is 294 begin 295 AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter 296 (Self.Element, 297 AMF.Internals.Helpers.To_Element 298 (AMF.Elements.Element_Access (To))); 299 end Set_Owning_Template_Parameter; 300 301 ---------------------------- 302 -- Set_Template_Parameter -- 303 ---------------------------- 304 305 overriding procedure Set_Template_Parameter 306 (Self : not null access UML_Literal_Integer_Proxy; 307 To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is 308 begin 309 AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter 310 (Self.Element, 311 AMF.Internals.Helpers.To_Element 312 (AMF.Elements.Element_Access (To))); 313 end Set_Template_Parameter; 314 315 -------------- 316 -- Set_Type -- 317 -------------- 318 319 overriding procedure Set_Type 320 (Self : not null access UML_Literal_Integer_Proxy; 321 To : AMF.UML.Types.UML_Type_Access) is 322 begin 323 AMF.Internals.Tables.UML_Attributes.Internal_Set_Type 324 (Self.Element, 325 AMF.Internals.Helpers.To_Element 326 (AMF.Elements.Element_Access (To))); 327 end Set_Type; 328 329 --------------- 330 -- Set_Value -- 331 --------------- 332 333 overriding procedure Set_Value 334 (Self : not null access UML_Literal_Integer_Proxy; 335 To : Integer) is 336 begin 337 AMF.Internals.Tables.UML_Attributes.Internal_Set_Value 338 (Self.Element, To); 339 end Set_Value; 340 341 ------------------- 342 -- Is_Computable -- 343 ------------------- 344 345 overriding function Is_Computable 346 (Self : not null access constant UML_Literal_Integer_Proxy) 347 return Boolean is 348 begin 349 -- Generated stub: replace with real body! 350 pragma Compile_Time_Warning (Standard.True, "Is_Computable unimplemented"); 351 raise Program_Error with "Unimplemented procedure UML_Literal_Integer_Proxy.Is_Computable"; 352 return Is_Computable (Self); 353 end Is_Computable; 354 355 ------------------------ 356 -- Is_Compatible_With -- 357 ------------------------ 358 359 overriding function Is_Compatible_With 360 (Self : not null access constant UML_Literal_Integer_Proxy; 361 P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) 362 return Boolean is 363 begin 364 -- Generated stub: replace with real body! 365 pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented"); 366 raise Program_Error with "Unimplemented procedure UML_Literal_Integer_Proxy.Is_Compatible_With"; 367 return Is_Compatible_With (Self, P); 368 end Is_Compatible_With; 369 370 ------------------------- 371 -- All_Owning_Packages -- 372 ------------------------- 373 374 overriding function All_Owning_Packages 375 (Self : not null access constant UML_Literal_Integer_Proxy) 376 return AMF.UML.Packages.Collections.Set_Of_UML_Package is 377 begin 378 -- Generated stub: replace with real body! 379 pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); 380 raise Program_Error with "Unimplemented procedure UML_Literal_Integer_Proxy.All_Owning_Packages"; 381 return All_Owning_Packages (Self); 382 end All_Owning_Packages; 383 384 ----------------------------- 385 -- Is_Distinguishable_From -- 386 ----------------------------- 387 388 overriding function Is_Distinguishable_From 389 (Self : not null access constant UML_Literal_Integer_Proxy; 390 N : AMF.UML.Named_Elements.UML_Named_Element_Access; 391 Ns : AMF.UML.Namespaces.UML_Namespace_Access) 392 return Boolean is 393 begin 394 -- Generated stub: replace with real body! 395 pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); 396 raise Program_Error with "Unimplemented procedure UML_Literal_Integer_Proxy.Is_Distinguishable_From"; 397 return Is_Distinguishable_From (Self, N, Ns); 398 end Is_Distinguishable_From; 399 400 --------------- 401 -- Namespace -- 402 --------------- 403 404 overriding function Namespace 405 (Self : not null access constant UML_Literal_Integer_Proxy) 406 return AMF.UML.Namespaces.UML_Namespace_Access is 407 begin 408 -- Generated stub: replace with real body! 409 pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); 410 raise Program_Error with "Unimplemented procedure UML_Literal_Integer_Proxy.Namespace"; 411 return Namespace (Self); 412 end Namespace; 413 414 --------------------------- 415 -- Is_Template_Parameter -- 416 --------------------------- 417 418 overriding function Is_Template_Parameter 419 (Self : not null access constant UML_Literal_Integer_Proxy) 420 return Boolean is 421 begin 422 -- Generated stub: replace with real body! 423 pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented"); 424 raise Program_Error with "Unimplemented procedure UML_Literal_Integer_Proxy.Is_Template_Parameter"; 425 return Is_Template_Parameter (Self); 426 end Is_Template_Parameter; 427 428end AMF.Internals.UML_Literal_Integers; 429