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_Interruptible_Activity_Regions is
54
55   -------------------
56   -- Enter_Element --
57   -------------------
58
59   overriding procedure Enter_Element
60    (Self    : not null access constant UML_Interruptible_Activity_Region_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_Interruptible_Activity_Region
67            (AMF.UML.Interruptible_Activity_Regions.UML_Interruptible_Activity_Region_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_Interruptible_Activity_Region_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_Interruptible_Activity_Region
84            (AMF.UML.Interruptible_Activity_Regions.UML_Interruptible_Activity_Region_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_Interruptible_Activity_Region_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_Interruptible_Activity_Region
102            (Visitor,
103             AMF.UML.Interruptible_Activity_Regions.UML_Interruptible_Activity_Region_Access (Self),
104             Control);
105      end if;
106   end Visit_Element;
107
108   ---------------------------
109   -- Get_Interrupting_Edge --
110   ---------------------------
111
112   overriding function Get_Interrupting_Edge
113    (Self : not null access constant UML_Interruptible_Activity_Region_Proxy)
114       return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is
115   begin
116      return
117        AMF.UML.Activity_Edges.Collections.Wrap
118         (AMF.Internals.Element_Collections.Wrap
119           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Interrupting_Edge
120             (Self.Element)));
121   end Get_Interrupting_Edge;
122
123   --------------
124   -- Get_Node --
125   --------------
126
127   overriding function Get_Node
128    (Self : not null access constant UML_Interruptible_Activity_Region_Proxy)
129       return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is
130   begin
131      return
132        AMF.UML.Activity_Nodes.Collections.Wrap
133         (AMF.Internals.Element_Collections.Wrap
134           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Node
135             (Self.Element)));
136   end Get_Node;
137
138   ------------------------
139   -- Get_Contained_Edge --
140   ------------------------
141
142   overriding function Get_Contained_Edge
143    (Self : not null access constant UML_Interruptible_Activity_Region_Proxy)
144       return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is
145   begin
146      return
147        AMF.UML.Activity_Edges.Collections.Wrap
148         (AMF.Internals.Element_Collections.Wrap
149           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Contained_Edge
150             (Self.Element)));
151   end Get_Contained_Edge;
152
153   ------------------------
154   -- Get_Contained_Node --
155   ------------------------
156
157   overriding function Get_Contained_Node
158    (Self : not null access constant UML_Interruptible_Activity_Region_Proxy)
159       return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is
160   begin
161      return
162        AMF.UML.Activity_Nodes.Collections.Wrap
163         (AMF.Internals.Element_Collections.Wrap
164           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Contained_Node
165             (Self.Element)));
166   end Get_Contained_Node;
167
168   ---------------------
169   -- Get_In_Activity --
170   ---------------------
171
172   overriding function Get_In_Activity
173    (Self : not null access constant UML_Interruptible_Activity_Region_Proxy)
174       return AMF.UML.Activities.UML_Activity_Access is
175   begin
176      return
177        AMF.UML.Activities.UML_Activity_Access
178         (AMF.Internals.Helpers.To_Element
179           (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Activity
180             (Self.Element)));
181   end Get_In_Activity;
182
183   ---------------------
184   -- Set_In_Activity --
185   ---------------------
186
187   overriding procedure Set_In_Activity
188    (Self : not null access UML_Interruptible_Activity_Region_Proxy;
189     To   : AMF.UML.Activities.UML_Activity_Access) is
190   begin
191      AMF.Internals.Tables.UML_Attributes.Internal_Set_In_Activity
192       (Self.Element,
193        AMF.Internals.Helpers.To_Element
194         (AMF.Elements.Element_Access (To)));
195   end Set_In_Activity;
196
197   ------------------
198   -- Get_Subgroup --
199   ------------------
200
201   overriding function Get_Subgroup
202    (Self : not null access constant UML_Interruptible_Activity_Region_Proxy)
203       return AMF.UML.Activity_Groups.Collections.Set_Of_UML_Activity_Group is
204   begin
205      return
206        AMF.UML.Activity_Groups.Collections.Wrap
207         (AMF.Internals.Element_Collections.Wrap
208           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Subgroup
209             (Self.Element)));
210   end Get_Subgroup;
211
212   ---------------------
213   -- Get_Super_Group --
214   ---------------------
215
216   overriding function Get_Super_Group
217    (Self : not null access constant UML_Interruptible_Activity_Region_Proxy)
218       return AMF.UML.Activity_Groups.UML_Activity_Group_Access is
219   begin
220      return
221        AMF.UML.Activity_Groups.UML_Activity_Group_Access
222         (AMF.Internals.Helpers.To_Element
223           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Super_Group
224             (Self.Element)));
225   end Get_Super_Group;
226
227   ---------------------------
228   -- Get_Client_Dependency --
229   ---------------------------
230
231   overriding function Get_Client_Dependency
232    (Self : not null access constant UML_Interruptible_Activity_Region_Proxy)
233       return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
234   begin
235      return
236        AMF.UML.Dependencies.Collections.Wrap
237         (AMF.Internals.Element_Collections.Wrap
238           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
239             (Self.Element)));
240   end Get_Client_Dependency;
241
242   -------------------------
243   -- Get_Name_Expression --
244   -------------------------
245
246   overriding function Get_Name_Expression
247    (Self : not null access constant UML_Interruptible_Activity_Region_Proxy)
248       return AMF.UML.String_Expressions.UML_String_Expression_Access is
249   begin
250      return
251        AMF.UML.String_Expressions.UML_String_Expression_Access
252         (AMF.Internals.Helpers.To_Element
253           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
254             (Self.Element)));
255   end Get_Name_Expression;
256
257   -------------------------
258   -- Set_Name_Expression --
259   -------------------------
260
261   overriding procedure Set_Name_Expression
262    (Self : not null access UML_Interruptible_Activity_Region_Proxy;
263     To   : AMF.UML.String_Expressions.UML_String_Expression_Access) is
264   begin
265      AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
266       (Self.Element,
267        AMF.Internals.Helpers.To_Element
268         (AMF.Elements.Element_Access (To)));
269   end Set_Name_Expression;
270
271   -------------------
272   -- Get_Namespace --
273   -------------------
274
275   overriding function Get_Namespace
276    (Self : not null access constant UML_Interruptible_Activity_Region_Proxy)
277       return AMF.UML.Namespaces.UML_Namespace_Access is
278   begin
279      return
280        AMF.UML.Namespaces.UML_Namespace_Access
281         (AMF.Internals.Helpers.To_Element
282           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
283             (Self.Element)));
284   end Get_Namespace;
285
286   ------------------------
287   -- Get_Qualified_Name --
288   ------------------------
289
290   overriding function Get_Qualified_Name
291    (Self : not null access constant UML_Interruptible_Activity_Region_Proxy)
292       return AMF.Optional_String is
293   begin
294      declare
295         use type Matreshka.Internals.Strings.Shared_String_Access;
296
297         Aux : constant Matreshka.Internals.Strings.Shared_String_Access
298           := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
299
300      begin
301         if Aux = null then
302            return (Is_Empty => True);
303
304         else
305            return (False, League.Strings.Internals.Create (Aux));
306         end if;
307      end;
308   end Get_Qualified_Name;
309
310   -------------------------
311   -- All_Owning_Packages --
312   -------------------------
313
314   overriding function All_Owning_Packages
315    (Self : not null access constant UML_Interruptible_Activity_Region_Proxy)
316       return AMF.UML.Packages.Collections.Set_Of_UML_Package is
317   begin
318      --  Generated stub: replace with real body!
319      pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
320      raise Program_Error with "Unimplemented procedure UML_Interruptible_Activity_Region_Proxy.All_Owning_Packages";
321      return All_Owning_Packages (Self);
322   end All_Owning_Packages;
323
324   -----------------------------
325   -- Is_Distinguishable_From --
326   -----------------------------
327
328   overriding function Is_Distinguishable_From
329    (Self : not null access constant UML_Interruptible_Activity_Region_Proxy;
330     N : AMF.UML.Named_Elements.UML_Named_Element_Access;
331     Ns : AMF.UML.Namespaces.UML_Namespace_Access)
332       return Boolean is
333   begin
334      --  Generated stub: replace with real body!
335      pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
336      raise Program_Error with "Unimplemented procedure UML_Interruptible_Activity_Region_Proxy.Is_Distinguishable_From";
337      return Is_Distinguishable_From (Self, N, Ns);
338   end Is_Distinguishable_From;
339
340   ---------------
341   -- Namespace --
342   ---------------
343
344   overriding function Namespace
345    (Self : not null access constant UML_Interruptible_Activity_Region_Proxy)
346       return AMF.UML.Namespaces.UML_Namespace_Access is
347   begin
348      --  Generated stub: replace with real body!
349      pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
350      raise Program_Error with "Unimplemented procedure UML_Interruptible_Activity_Region_Proxy.Namespace";
351      return Namespace (Self);
352   end Namespace;
353
354end AMF.Internals.UML_Interruptible_Activity_Regions;
355