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