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_Activity_Final_Nodes is
54
55   -------------------
56   -- Enter_Element --
57   -------------------
58
59   overriding procedure Enter_Element
60    (Self    : not null access constant UML_Activity_Final_Node_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_Activity_Final_Node
67            (AMF.UML.Activity_Final_Nodes.UML_Activity_Final_Node_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_Activity_Final_Node_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_Activity_Final_Node
84            (AMF.UML.Activity_Final_Nodes.UML_Activity_Final_Node_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_Activity_Final_Node_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_Activity_Final_Node
102            (Visitor,
103             AMF.UML.Activity_Final_Nodes.UML_Activity_Final_Node_Access (Self),
104             Control);
105      end if;
106   end Visit_Element;
107
108   ------------------
109   -- Get_Activity --
110   ------------------
111
112   overriding function Get_Activity
113    (Self : not null access constant UML_Activity_Final_Node_Proxy)
114       return AMF.UML.Activities.UML_Activity_Access is
115   begin
116      return
117        AMF.UML.Activities.UML_Activity_Access
118         (AMF.Internals.Helpers.To_Element
119           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Activity
120             (Self.Element)));
121   end Get_Activity;
122
123   ------------------
124   -- Set_Activity --
125   ------------------
126
127   overriding procedure Set_Activity
128    (Self : not null access UML_Activity_Final_Node_Proxy;
129     To   : AMF.UML.Activities.UML_Activity_Access) is
130   begin
131      AMF.Internals.Tables.UML_Attributes.Internal_Set_Activity
132       (Self.Element,
133        AMF.Internals.Helpers.To_Element
134         (AMF.Elements.Element_Access (To)));
135   end Set_Activity;
136
137   ------------------
138   -- Get_In_Group --
139   ------------------
140
141   overriding function Get_In_Group
142    (Self : not null access constant UML_Activity_Final_Node_Proxy)
143       return AMF.UML.Activity_Groups.Collections.Set_Of_UML_Activity_Group is
144   begin
145      return
146        AMF.UML.Activity_Groups.Collections.Wrap
147         (AMF.Internals.Element_Collections.Wrap
148           (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Group
149             (Self.Element)));
150   end Get_In_Group;
151
152   ---------------------------------
153   -- Get_In_Interruptible_Region --
154   ---------------------------------
155
156   overriding function Get_In_Interruptible_Region
157    (Self : not null access constant UML_Activity_Final_Node_Proxy)
158       return AMF.UML.Interruptible_Activity_Regions.Collections.Set_Of_UML_Interruptible_Activity_Region is
159   begin
160      return
161        AMF.UML.Interruptible_Activity_Regions.Collections.Wrap
162         (AMF.Internals.Element_Collections.Wrap
163           (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Interruptible_Region
164             (Self.Element)));
165   end Get_In_Interruptible_Region;
166
167   ----------------------
168   -- Get_In_Partition --
169   ----------------------
170
171   overriding function Get_In_Partition
172    (Self : not null access constant UML_Activity_Final_Node_Proxy)
173       return AMF.UML.Activity_Partitions.Collections.Set_Of_UML_Activity_Partition is
174   begin
175      return
176        AMF.UML.Activity_Partitions.Collections.Wrap
177         (AMF.Internals.Element_Collections.Wrap
178           (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Partition
179             (Self.Element)));
180   end Get_In_Partition;
181
182   ----------------------------
183   -- Get_In_Structured_Node --
184   ----------------------------
185
186   overriding function Get_In_Structured_Node
187    (Self : not null access constant UML_Activity_Final_Node_Proxy)
188       return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access is
189   begin
190      return
191        AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access
192         (AMF.Internals.Helpers.To_Element
193           (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Structured_Node
194             (Self.Element)));
195   end Get_In_Structured_Node;
196
197   ----------------------------
198   -- Set_In_Structured_Node --
199   ----------------------------
200
201   overriding procedure Set_In_Structured_Node
202    (Self : not null access UML_Activity_Final_Node_Proxy;
203     To   : AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access) is
204   begin
205      AMF.Internals.Tables.UML_Attributes.Internal_Set_In_Structured_Node
206       (Self.Element,
207        AMF.Internals.Helpers.To_Element
208         (AMF.Elements.Element_Access (To)));
209   end Set_In_Structured_Node;
210
211   ------------------
212   -- Get_Incoming --
213   ------------------
214
215   overriding function Get_Incoming
216    (Self : not null access constant UML_Activity_Final_Node_Proxy)
217       return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is
218   begin
219      return
220        AMF.UML.Activity_Edges.Collections.Wrap
221         (AMF.Internals.Element_Collections.Wrap
222           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Incoming
223             (Self.Element)));
224   end Get_Incoming;
225
226   ------------------
227   -- Get_Outgoing --
228   ------------------
229
230   overriding function Get_Outgoing
231    (Self : not null access constant UML_Activity_Final_Node_Proxy)
232       return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is
233   begin
234      return
235        AMF.UML.Activity_Edges.Collections.Wrap
236         (AMF.Internals.Element_Collections.Wrap
237           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Outgoing
238             (Self.Element)));
239   end Get_Outgoing;
240
241   ------------------------
242   -- Get_Redefined_Node --
243   ------------------------
244
245   overriding function Get_Redefined_Node
246    (Self : not null access constant UML_Activity_Final_Node_Proxy)
247       return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is
248   begin
249      return
250        AMF.UML.Activity_Nodes.Collections.Wrap
251         (AMF.Internals.Element_Collections.Wrap
252           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Node
253             (Self.Element)));
254   end Get_Redefined_Node;
255
256   -----------------
257   -- Get_Is_Leaf --
258   -----------------
259
260   overriding function Get_Is_Leaf
261    (Self : not null access constant UML_Activity_Final_Node_Proxy)
262       return Boolean is
263   begin
264      return
265        AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf
266         (Self.Element);
267   end Get_Is_Leaf;
268
269   -----------------
270   -- Set_Is_Leaf --
271   -----------------
272
273   overriding procedure Set_Is_Leaf
274    (Self : not null access UML_Activity_Final_Node_Proxy;
275     To   : Boolean) is
276   begin
277      AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf
278       (Self.Element, To);
279   end Set_Is_Leaf;
280
281   ---------------------------
282   -- Get_Redefined_Element --
283   ---------------------------
284
285   overriding function Get_Redefined_Element
286    (Self : not null access constant UML_Activity_Final_Node_Proxy)
287       return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is
288   begin
289      return
290        AMF.UML.Redefinable_Elements.Collections.Wrap
291         (AMF.Internals.Element_Collections.Wrap
292           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element
293             (Self.Element)));
294   end Get_Redefined_Element;
295
296   ------------------------------
297   -- Get_Redefinition_Context --
298   ------------------------------
299
300   overriding function Get_Redefinition_Context
301    (Self : not null access constant UML_Activity_Final_Node_Proxy)
302       return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
303   begin
304      return
305        AMF.UML.Classifiers.Collections.Wrap
306         (AMF.Internals.Element_Collections.Wrap
307           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context
308             (Self.Element)));
309   end Get_Redefinition_Context;
310
311   ---------------------------
312   -- Get_Client_Dependency --
313   ---------------------------
314
315   overriding function Get_Client_Dependency
316    (Self : not null access constant UML_Activity_Final_Node_Proxy)
317       return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
318   begin
319      return
320        AMF.UML.Dependencies.Collections.Wrap
321         (AMF.Internals.Element_Collections.Wrap
322           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
323             (Self.Element)));
324   end Get_Client_Dependency;
325
326   -------------------------
327   -- Get_Name_Expression --
328   -------------------------
329
330   overriding function Get_Name_Expression
331    (Self : not null access constant UML_Activity_Final_Node_Proxy)
332       return AMF.UML.String_Expressions.UML_String_Expression_Access is
333   begin
334      return
335        AMF.UML.String_Expressions.UML_String_Expression_Access
336         (AMF.Internals.Helpers.To_Element
337           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
338             (Self.Element)));
339   end Get_Name_Expression;
340
341   -------------------------
342   -- Set_Name_Expression --
343   -------------------------
344
345   overriding procedure Set_Name_Expression
346    (Self : not null access UML_Activity_Final_Node_Proxy;
347     To   : AMF.UML.String_Expressions.UML_String_Expression_Access) is
348   begin
349      AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
350       (Self.Element,
351        AMF.Internals.Helpers.To_Element
352         (AMF.Elements.Element_Access (To)));
353   end Set_Name_Expression;
354
355   -------------------
356   -- Get_Namespace --
357   -------------------
358
359   overriding function Get_Namespace
360    (Self : not null access constant UML_Activity_Final_Node_Proxy)
361       return AMF.UML.Namespaces.UML_Namespace_Access is
362   begin
363      return
364        AMF.UML.Namespaces.UML_Namespace_Access
365         (AMF.Internals.Helpers.To_Element
366           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
367             (Self.Element)));
368   end Get_Namespace;
369
370   ------------------------
371   -- Get_Qualified_Name --
372   ------------------------
373
374   overriding function Get_Qualified_Name
375    (Self : not null access constant UML_Activity_Final_Node_Proxy)
376       return AMF.Optional_String is
377   begin
378      declare
379         use type Matreshka.Internals.Strings.Shared_String_Access;
380
381         Aux : constant Matreshka.Internals.Strings.Shared_String_Access
382           := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
383
384      begin
385         if Aux = null then
386            return (Is_Empty => True);
387
388         else
389            return (False, League.Strings.Internals.Create (Aux));
390         end if;
391      end;
392   end Get_Qualified_Name;
393
394   ------------------------
395   -- Is_Consistent_With --
396   ------------------------
397
398   overriding function Is_Consistent_With
399    (Self : not null access constant UML_Activity_Final_Node_Proxy;
400     Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
401       return Boolean is
402   begin
403      --  Generated stub: replace with real body!
404      pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented");
405      raise Program_Error with "Unimplemented procedure UML_Activity_Final_Node_Proxy.Is_Consistent_With";
406      return Is_Consistent_With (Self, Redefinee);
407   end Is_Consistent_With;
408
409   -----------------------------------
410   -- Is_Redefinition_Context_Valid --
411   -----------------------------------
412
413   overriding function Is_Redefinition_Context_Valid
414    (Self : not null access constant UML_Activity_Final_Node_Proxy;
415     Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
416       return Boolean is
417   begin
418      --  Generated stub: replace with real body!
419      pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented");
420      raise Program_Error with "Unimplemented procedure UML_Activity_Final_Node_Proxy.Is_Redefinition_Context_Valid";
421      return Is_Redefinition_Context_Valid (Self, Redefined);
422   end Is_Redefinition_Context_Valid;
423
424   -------------------------
425   -- All_Owning_Packages --
426   -------------------------
427
428   overriding function All_Owning_Packages
429    (Self : not null access constant UML_Activity_Final_Node_Proxy)
430       return AMF.UML.Packages.Collections.Set_Of_UML_Package is
431   begin
432      --  Generated stub: replace with real body!
433      pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
434      raise Program_Error with "Unimplemented procedure UML_Activity_Final_Node_Proxy.All_Owning_Packages";
435      return All_Owning_Packages (Self);
436   end All_Owning_Packages;
437
438   -----------------------------
439   -- Is_Distinguishable_From --
440   -----------------------------
441
442   overriding function Is_Distinguishable_From
443    (Self : not null access constant UML_Activity_Final_Node_Proxy;
444     N : AMF.UML.Named_Elements.UML_Named_Element_Access;
445     Ns : AMF.UML.Namespaces.UML_Namespace_Access)
446       return Boolean is
447   begin
448      --  Generated stub: replace with real body!
449      pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
450      raise Program_Error with "Unimplemented procedure UML_Activity_Final_Node_Proxy.Is_Distinguishable_From";
451      return Is_Distinguishable_From (Self, N, Ns);
452   end Is_Distinguishable_From;
453
454   ---------------
455   -- Namespace --
456   ---------------
457
458   overriding function Namespace
459    (Self : not null access constant UML_Activity_Final_Node_Proxy)
460       return AMF.UML.Namespaces.UML_Namespace_Access is
461   begin
462      --  Generated stub: replace with real body!
463      pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
464      raise Program_Error with "Unimplemented procedure UML_Activity_Final_Node_Proxy.Namespace";
465      return Namespace (Self);
466   end Namespace;
467
468end AMF.Internals.UML_Activity_Final_Nodes;
469