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