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