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