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_Part_Decompositions is
54
55   -------------------
56   -- Enter_Element --
57   -------------------
58
59   overriding procedure Enter_Element
60    (Self    : not null access constant UML_Part_Decomposition_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_Part_Decomposition
67            (AMF.UML.Part_Decompositions.UML_Part_Decomposition_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_Part_Decomposition_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_Part_Decomposition
84            (AMF.UML.Part_Decompositions.UML_Part_Decomposition_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_Part_Decomposition_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_Part_Decomposition
102            (Visitor,
103             AMF.UML.Part_Decompositions.UML_Part_Decomposition_Access (Self),
104             Control);
105      end if;
106   end Visit_Element;
107
108   ---------------------
109   -- Get_Actual_Gate --
110   ---------------------
111
112   overriding function Get_Actual_Gate
113    (Self : not null access constant UML_Part_Decomposition_Proxy)
114       return AMF.UML.Gates.Collections.Set_Of_UML_Gate is
115   begin
116      return
117        AMF.UML.Gates.Collections.Wrap
118         (AMF.Internals.Element_Collections.Wrap
119           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Actual_Gate
120             (Self.Element)));
121   end Get_Actual_Gate;
122
123   ------------------
124   -- Get_Argument --
125   ------------------
126
127   overriding function Get_Argument
128    (Self : not null access constant UML_Part_Decomposition_Proxy)
129       return AMF.UML.Value_Specifications.Collections.Ordered_Set_Of_UML_Value_Specification is
130   begin
131      return
132        AMF.UML.Value_Specifications.Collections.Wrap
133         (AMF.Internals.Element_Collections.Wrap
134           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Argument
135             (Self.Element)));
136   end Get_Argument;
137
138   -------------------
139   -- Get_Refers_To --
140   -------------------
141
142   overriding function Get_Refers_To
143    (Self : not null access constant UML_Part_Decomposition_Proxy)
144       return AMF.UML.Interactions.UML_Interaction_Access is
145   begin
146      return
147        AMF.UML.Interactions.UML_Interaction_Access
148         (AMF.Internals.Helpers.To_Element
149           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Refers_To
150             (Self.Element)));
151   end Get_Refers_To;
152
153   -------------------
154   -- Set_Refers_To --
155   -------------------
156
157   overriding procedure Set_Refers_To
158    (Self : not null access UML_Part_Decomposition_Proxy;
159     To   : AMF.UML.Interactions.UML_Interaction_Access) is
160   begin
161      AMF.Internals.Tables.UML_Attributes.Internal_Set_Refers_To
162       (Self.Element,
163        AMF.Internals.Helpers.To_Element
164         (AMF.Elements.Element_Access (To)));
165   end Set_Refers_To;
166
167   ----------------------
168   -- Get_Return_Value --
169   ----------------------
170
171   overriding function Get_Return_Value
172    (Self : not null access constant UML_Part_Decomposition_Proxy)
173       return AMF.UML.Value_Specifications.UML_Value_Specification_Access is
174   begin
175      return
176        AMF.UML.Value_Specifications.UML_Value_Specification_Access
177         (AMF.Internals.Helpers.To_Element
178           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Return_Value
179             (Self.Element)));
180   end Get_Return_Value;
181
182   ----------------------
183   -- Set_Return_Value --
184   ----------------------
185
186   overriding procedure Set_Return_Value
187    (Self : not null access UML_Part_Decomposition_Proxy;
188     To   : AMF.UML.Value_Specifications.UML_Value_Specification_Access) is
189   begin
190      AMF.Internals.Tables.UML_Attributes.Internal_Set_Return_Value
191       (Self.Element,
192        AMF.Internals.Helpers.To_Element
193         (AMF.Elements.Element_Access (To)));
194   end Set_Return_Value;
195
196   --------------------------------
197   -- Get_Return_Value_Recipient --
198   --------------------------------
199
200   overriding function Get_Return_Value_Recipient
201    (Self : not null access constant UML_Part_Decomposition_Proxy)
202       return AMF.UML.Properties.UML_Property_Access is
203   begin
204      return
205        AMF.UML.Properties.UML_Property_Access
206         (AMF.Internals.Helpers.To_Element
207           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Return_Value_Recipient
208             (Self.Element)));
209   end Get_Return_Value_Recipient;
210
211   --------------------------------
212   -- Set_Return_Value_Recipient --
213   --------------------------------
214
215   overriding procedure Set_Return_Value_Recipient
216    (Self : not null access UML_Part_Decomposition_Proxy;
217     To   : AMF.UML.Properties.UML_Property_Access) is
218   begin
219      AMF.Internals.Tables.UML_Attributes.Internal_Set_Return_Value_Recipient
220       (Self.Element,
221        AMF.Internals.Helpers.To_Element
222         (AMF.Elements.Element_Access (To)));
223   end Set_Return_Value_Recipient;
224
225   -----------------
226   -- Get_Covered --
227   -----------------
228
229   overriding function Get_Covered
230    (Self : not null access constant UML_Part_Decomposition_Proxy)
231       return AMF.UML.Lifelines.Collections.Set_Of_UML_Lifeline is
232   begin
233      return
234        AMF.UML.Lifelines.Collections.Wrap
235         (AMF.Internals.Element_Collections.Wrap
236           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Covered
237             (Self.Element)));
238   end Get_Covered;
239
240   -------------------------------
241   -- Get_Enclosing_Interaction --
242   -------------------------------
243
244   overriding function Get_Enclosing_Interaction
245    (Self : not null access constant UML_Part_Decomposition_Proxy)
246       return AMF.UML.Interactions.UML_Interaction_Access is
247   begin
248      return
249        AMF.UML.Interactions.UML_Interaction_Access
250         (AMF.Internals.Helpers.To_Element
251           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Enclosing_Interaction
252             (Self.Element)));
253   end Get_Enclosing_Interaction;
254
255   -------------------------------
256   -- Set_Enclosing_Interaction --
257   -------------------------------
258
259   overriding procedure Set_Enclosing_Interaction
260    (Self : not null access UML_Part_Decomposition_Proxy;
261     To   : AMF.UML.Interactions.UML_Interaction_Access) is
262   begin
263      AMF.Internals.Tables.UML_Attributes.Internal_Set_Enclosing_Interaction
264       (Self.Element,
265        AMF.Internals.Helpers.To_Element
266         (AMF.Elements.Element_Access (To)));
267   end Set_Enclosing_Interaction;
268
269   ---------------------------
270   -- Get_Enclosing_Operand --
271   ---------------------------
272
273   overriding function Get_Enclosing_Operand
274    (Self : not null access constant UML_Part_Decomposition_Proxy)
275       return AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access is
276   begin
277      return
278        AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access
279         (AMF.Internals.Helpers.To_Element
280           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Enclosing_Operand
281             (Self.Element)));
282   end Get_Enclosing_Operand;
283
284   ---------------------------
285   -- Set_Enclosing_Operand --
286   ---------------------------
287
288   overriding procedure Set_Enclosing_Operand
289    (Self : not null access UML_Part_Decomposition_Proxy;
290     To   : AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access) is
291   begin
292      AMF.Internals.Tables.UML_Attributes.Internal_Set_Enclosing_Operand
293       (Self.Element,
294        AMF.Internals.Helpers.To_Element
295         (AMF.Elements.Element_Access (To)));
296   end Set_Enclosing_Operand;
297
298   --------------------------
299   -- Get_General_Ordering --
300   --------------------------
301
302   overriding function Get_General_Ordering
303    (Self : not null access constant UML_Part_Decomposition_Proxy)
304       return AMF.UML.General_Orderings.Collections.Set_Of_UML_General_Ordering is
305   begin
306      return
307        AMF.UML.General_Orderings.Collections.Wrap
308         (AMF.Internals.Element_Collections.Wrap
309           (AMF.Internals.Tables.UML_Attributes.Internal_Get_General_Ordering
310             (Self.Element)));
311   end Get_General_Ordering;
312
313   ---------------------------
314   -- Get_Client_Dependency --
315   ---------------------------
316
317   overriding function Get_Client_Dependency
318    (Self : not null access constant UML_Part_Decomposition_Proxy)
319       return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
320   begin
321      return
322        AMF.UML.Dependencies.Collections.Wrap
323         (AMF.Internals.Element_Collections.Wrap
324           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
325             (Self.Element)));
326   end Get_Client_Dependency;
327
328   -------------------------
329   -- Get_Name_Expression --
330   -------------------------
331
332   overriding function Get_Name_Expression
333    (Self : not null access constant UML_Part_Decomposition_Proxy)
334       return AMF.UML.String_Expressions.UML_String_Expression_Access is
335   begin
336      return
337        AMF.UML.String_Expressions.UML_String_Expression_Access
338         (AMF.Internals.Helpers.To_Element
339           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
340             (Self.Element)));
341   end Get_Name_Expression;
342
343   -------------------------
344   -- Set_Name_Expression --
345   -------------------------
346
347   overriding procedure Set_Name_Expression
348    (Self : not null access UML_Part_Decomposition_Proxy;
349     To   : AMF.UML.String_Expressions.UML_String_Expression_Access) is
350   begin
351      AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
352       (Self.Element,
353        AMF.Internals.Helpers.To_Element
354         (AMF.Elements.Element_Access (To)));
355   end Set_Name_Expression;
356
357   -------------------
358   -- Get_Namespace --
359   -------------------
360
361   overriding function Get_Namespace
362    (Self : not null access constant UML_Part_Decomposition_Proxy)
363       return AMF.UML.Namespaces.UML_Namespace_Access is
364   begin
365      return
366        AMF.UML.Namespaces.UML_Namespace_Access
367         (AMF.Internals.Helpers.To_Element
368           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
369             (Self.Element)));
370   end Get_Namespace;
371
372   ------------------------
373   -- Get_Qualified_Name --
374   ------------------------
375
376   overriding function Get_Qualified_Name
377    (Self : not null access constant UML_Part_Decomposition_Proxy)
378       return AMF.Optional_String is
379   begin
380      declare
381         use type Matreshka.Internals.Strings.Shared_String_Access;
382
383         Aux : constant Matreshka.Internals.Strings.Shared_String_Access
384           := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
385
386      begin
387         if Aux = null then
388            return (Is_Empty => True);
389
390         else
391            return (False, League.Strings.Internals.Create (Aux));
392         end if;
393      end;
394   end Get_Qualified_Name;
395
396   -------------------------
397   -- All_Owning_Packages --
398   -------------------------
399
400   overriding function All_Owning_Packages
401    (Self : not null access constant UML_Part_Decomposition_Proxy)
402       return AMF.UML.Packages.Collections.Set_Of_UML_Package is
403   begin
404      --  Generated stub: replace with real body!
405      pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
406      raise Program_Error with "Unimplemented procedure UML_Part_Decomposition_Proxy.All_Owning_Packages";
407      return All_Owning_Packages (Self);
408   end All_Owning_Packages;
409
410   -----------------------------
411   -- Is_Distinguishable_From --
412   -----------------------------
413
414   overriding function Is_Distinguishable_From
415    (Self : not null access constant UML_Part_Decomposition_Proxy;
416     N : AMF.UML.Named_Elements.UML_Named_Element_Access;
417     Ns : AMF.UML.Namespaces.UML_Namespace_Access)
418       return Boolean is
419   begin
420      --  Generated stub: replace with real body!
421      pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
422      raise Program_Error with "Unimplemented procedure UML_Part_Decomposition_Proxy.Is_Distinguishable_From";
423      return Is_Distinguishable_From (Self, N, Ns);
424   end Is_Distinguishable_From;
425
426   ---------------
427   -- Namespace --
428   ---------------
429
430   overriding function Namespace
431    (Self : not null access constant UML_Part_Decomposition_Proxy)
432       return AMF.UML.Namespaces.UML_Namespace_Access is
433   begin
434      --  Generated stub: replace with real body!
435      pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
436      raise Program_Error with "Unimplemented procedure UML_Part_Decomposition_Proxy.Namespace";
437      return Namespace (Self);
438   end Namespace;
439
440end AMF.Internals.UML_Part_Decompositions;
441