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