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_Interaction_Operands is
54
55   -------------------
56   -- Enter_Element --
57   -------------------
58
59   overriding procedure Enter_Element
60    (Self    : not null access constant UML_Interaction_Operand_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_Interaction_Operand
67            (AMF.UML.Interaction_Operands.UML_Interaction_Operand_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_Interaction_Operand_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_Interaction_Operand
84            (AMF.UML.Interaction_Operands.UML_Interaction_Operand_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_Interaction_Operand_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_Interaction_Operand
102            (Visitor,
103             AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access (Self),
104             Control);
105      end if;
106   end Visit_Element;
107
108   ------------------
109   -- Get_Fragment --
110   ------------------
111
112   overriding function Get_Fragment
113    (Self : not null access constant UML_Interaction_Operand_Proxy)
114       return AMF.UML.Interaction_Fragments.Collections.Ordered_Set_Of_UML_Interaction_Fragment is
115   begin
116      return
117        AMF.UML.Interaction_Fragments.Collections.Wrap
118         (AMF.Internals.Element_Collections.Wrap
119           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Fragment
120             (Self.Element)));
121   end Get_Fragment;
122
123   ---------------
124   -- Get_Guard --
125   ---------------
126
127   overriding function Get_Guard
128    (Self : not null access constant UML_Interaction_Operand_Proxy)
129       return AMF.UML.Interaction_Constraints.UML_Interaction_Constraint_Access is
130   begin
131      return
132        AMF.UML.Interaction_Constraints.UML_Interaction_Constraint_Access
133         (AMF.Internals.Helpers.To_Element
134           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Guard
135             (Self.Element)));
136   end Get_Guard;
137
138   ---------------
139   -- Set_Guard --
140   ---------------
141
142   overriding procedure Set_Guard
143    (Self : not null access UML_Interaction_Operand_Proxy;
144     To   : AMF.UML.Interaction_Constraints.UML_Interaction_Constraint_Access) is
145   begin
146      AMF.Internals.Tables.UML_Attributes.Internal_Set_Guard
147       (Self.Element,
148        AMF.Internals.Helpers.To_Element
149         (AMF.Elements.Element_Access (To)));
150   end Set_Guard;
151
152   -----------------
153   -- Get_Covered --
154   -----------------
155
156   overriding function Get_Covered
157    (Self : not null access constant UML_Interaction_Operand_Proxy)
158       return AMF.UML.Lifelines.Collections.Set_Of_UML_Lifeline is
159   begin
160      return
161        AMF.UML.Lifelines.Collections.Wrap
162         (AMF.Internals.Element_Collections.Wrap
163           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Covered
164             (Self.Element)));
165   end Get_Covered;
166
167   -------------------------------
168   -- Get_Enclosing_Interaction --
169   -------------------------------
170
171   overriding function Get_Enclosing_Interaction
172    (Self : not null access constant UML_Interaction_Operand_Proxy)
173       return AMF.UML.Interactions.UML_Interaction_Access is
174   begin
175      return
176        AMF.UML.Interactions.UML_Interaction_Access
177         (AMF.Internals.Helpers.To_Element
178           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Enclosing_Interaction
179             (Self.Element)));
180   end Get_Enclosing_Interaction;
181
182   -------------------------------
183   -- Set_Enclosing_Interaction --
184   -------------------------------
185
186   overriding procedure Set_Enclosing_Interaction
187    (Self : not null access UML_Interaction_Operand_Proxy;
188     To   : AMF.UML.Interactions.UML_Interaction_Access) is
189   begin
190      AMF.Internals.Tables.UML_Attributes.Internal_Set_Enclosing_Interaction
191       (Self.Element,
192        AMF.Internals.Helpers.To_Element
193         (AMF.Elements.Element_Access (To)));
194   end Set_Enclosing_Interaction;
195
196   ---------------------------
197   -- Get_Enclosing_Operand --
198   ---------------------------
199
200   overriding function Get_Enclosing_Operand
201    (Self : not null access constant UML_Interaction_Operand_Proxy)
202       return AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access is
203   begin
204      return
205        AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access
206         (AMF.Internals.Helpers.To_Element
207           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Enclosing_Operand
208             (Self.Element)));
209   end Get_Enclosing_Operand;
210
211   ---------------------------
212   -- Set_Enclosing_Operand --
213   ---------------------------
214
215   overriding procedure Set_Enclosing_Operand
216    (Self : not null access UML_Interaction_Operand_Proxy;
217     To   : AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access) is
218   begin
219      AMF.Internals.Tables.UML_Attributes.Internal_Set_Enclosing_Operand
220       (Self.Element,
221        AMF.Internals.Helpers.To_Element
222         (AMF.Elements.Element_Access (To)));
223   end Set_Enclosing_Operand;
224
225   --------------------------
226   -- Get_General_Ordering --
227   --------------------------
228
229   overriding function Get_General_Ordering
230    (Self : not null access constant UML_Interaction_Operand_Proxy)
231       return AMF.UML.General_Orderings.Collections.Set_Of_UML_General_Ordering is
232   begin
233      return
234        AMF.UML.General_Orderings.Collections.Wrap
235         (AMF.Internals.Element_Collections.Wrap
236           (AMF.Internals.Tables.UML_Attributes.Internal_Get_General_Ordering
237             (Self.Element)));
238   end Get_General_Ordering;
239
240   ---------------------------
241   -- Get_Client_Dependency --
242   ---------------------------
243
244   overriding function Get_Client_Dependency
245    (Self : not null access constant UML_Interaction_Operand_Proxy)
246       return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
247   begin
248      return
249        AMF.UML.Dependencies.Collections.Wrap
250         (AMF.Internals.Element_Collections.Wrap
251           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
252             (Self.Element)));
253   end Get_Client_Dependency;
254
255   -------------------------
256   -- Get_Name_Expression --
257   -------------------------
258
259   overriding function Get_Name_Expression
260    (Self : not null access constant UML_Interaction_Operand_Proxy)
261       return AMF.UML.String_Expressions.UML_String_Expression_Access is
262   begin
263      return
264        AMF.UML.String_Expressions.UML_String_Expression_Access
265         (AMF.Internals.Helpers.To_Element
266           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
267             (Self.Element)));
268   end Get_Name_Expression;
269
270   -------------------------
271   -- Set_Name_Expression --
272   -------------------------
273
274   overriding procedure Set_Name_Expression
275    (Self : not null access UML_Interaction_Operand_Proxy;
276     To   : AMF.UML.String_Expressions.UML_String_Expression_Access) is
277   begin
278      AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
279       (Self.Element,
280        AMF.Internals.Helpers.To_Element
281         (AMF.Elements.Element_Access (To)));
282   end Set_Name_Expression;
283
284   -------------------
285   -- Get_Namespace --
286   -------------------
287
288   overriding function Get_Namespace
289    (Self : not null access constant UML_Interaction_Operand_Proxy)
290       return AMF.UML.Namespaces.UML_Namespace_Access is
291   begin
292      return
293        AMF.UML.Namespaces.UML_Namespace_Access
294         (AMF.Internals.Helpers.To_Element
295           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
296             (Self.Element)));
297   end Get_Namespace;
298
299   ------------------------
300   -- Get_Qualified_Name --
301   ------------------------
302
303   overriding function Get_Qualified_Name
304    (Self : not null access constant UML_Interaction_Operand_Proxy)
305       return AMF.Optional_String is
306   begin
307      declare
308         use type Matreshka.Internals.Strings.Shared_String_Access;
309
310         Aux : constant Matreshka.Internals.Strings.Shared_String_Access
311           := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
312
313      begin
314         if Aux = null then
315            return (Is_Empty => True);
316
317         else
318            return (False, League.Strings.Internals.Create (Aux));
319         end if;
320      end;
321   end Get_Qualified_Name;
322
323   ------------------------
324   -- Get_Element_Import --
325   ------------------------
326
327   overriding function Get_Element_Import
328    (Self : not null access constant UML_Interaction_Operand_Proxy)
329       return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import is
330   begin
331      return
332        AMF.UML.Element_Imports.Collections.Wrap
333         (AMF.Internals.Element_Collections.Wrap
334           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Element_Import
335             (Self.Element)));
336   end Get_Element_Import;
337
338   -------------------------
339   -- Get_Imported_Member --
340   -------------------------
341
342   overriding function Get_Imported_Member
343    (Self : not null access constant UML_Interaction_Operand_Proxy)
344       return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
345   begin
346      return
347        AMF.UML.Packageable_Elements.Collections.Wrap
348         (AMF.Internals.Element_Collections.Wrap
349           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Imported_Member
350             (Self.Element)));
351   end Get_Imported_Member;
352
353   ----------------
354   -- Get_Member --
355   ----------------
356
357   overriding function Get_Member
358    (Self : not null access constant UML_Interaction_Operand_Proxy)
359       return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
360   begin
361      return
362        AMF.UML.Named_Elements.Collections.Wrap
363         (AMF.Internals.Element_Collections.Wrap
364           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Member
365             (Self.Element)));
366   end Get_Member;
367
368   ----------------------
369   -- Get_Owned_Member --
370   ----------------------
371
372   overriding function Get_Owned_Member
373    (Self : not null access constant UML_Interaction_Operand_Proxy)
374       return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
375   begin
376      return
377        AMF.UML.Named_Elements.Collections.Wrap
378         (AMF.Internals.Element_Collections.Wrap
379           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Member
380             (Self.Element)));
381   end Get_Owned_Member;
382
383   --------------------
384   -- Get_Owned_Rule --
385   --------------------
386
387   overriding function Get_Owned_Rule
388    (Self : not null access constant UML_Interaction_Operand_Proxy)
389       return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
390   begin
391      return
392        AMF.UML.Constraints.Collections.Wrap
393         (AMF.Internals.Element_Collections.Wrap
394           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Rule
395             (Self.Element)));
396   end Get_Owned_Rule;
397
398   ------------------------
399   -- Get_Package_Import --
400   ------------------------
401
402   overriding function Get_Package_Import
403    (Self : not null access constant UML_Interaction_Operand_Proxy)
404       return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import is
405   begin
406      return
407        AMF.UML.Package_Imports.Collections.Wrap
408         (AMF.Internals.Element_Collections.Wrap
409           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Package_Import
410             (Self.Element)));
411   end Get_Package_Import;
412
413   -------------------------
414   -- All_Owning_Packages --
415   -------------------------
416
417   overriding function All_Owning_Packages
418    (Self : not null access constant UML_Interaction_Operand_Proxy)
419       return AMF.UML.Packages.Collections.Set_Of_UML_Package is
420   begin
421      --  Generated stub: replace with real body!
422      pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
423      raise Program_Error with "Unimplemented procedure UML_Interaction_Operand_Proxy.All_Owning_Packages";
424      return All_Owning_Packages (Self);
425   end All_Owning_Packages;
426
427   -----------------------------
428   -- Is_Distinguishable_From --
429   -----------------------------
430
431   overriding function Is_Distinguishable_From
432    (Self : not null access constant UML_Interaction_Operand_Proxy;
433     N : AMF.UML.Named_Elements.UML_Named_Element_Access;
434     Ns : AMF.UML.Namespaces.UML_Namespace_Access)
435       return Boolean is
436   begin
437      --  Generated stub: replace with real body!
438      pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
439      raise Program_Error with "Unimplemented procedure UML_Interaction_Operand_Proxy.Is_Distinguishable_From";
440      return Is_Distinguishable_From (Self, N, Ns);
441   end Is_Distinguishable_From;
442
443   ---------------
444   -- Namespace --
445   ---------------
446
447   overriding function Namespace
448    (Self : not null access constant UML_Interaction_Operand_Proxy)
449       return AMF.UML.Namespaces.UML_Namespace_Access is
450   begin
451      --  Generated stub: replace with real body!
452      pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
453      raise Program_Error with "Unimplemented procedure UML_Interaction_Operand_Proxy.Namespace";
454      return Namespace (Self);
455   end Namespace;
456
457   ------------------------
458   -- Exclude_Collisions --
459   ------------------------
460
461   overriding function Exclude_Collisions
462    (Self : not null access constant UML_Interaction_Operand_Proxy;
463     Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
464       return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
465   begin
466      --  Generated stub: replace with real body!
467      pragma Compile_Time_Warning (Standard.True, "Exclude_Collisions unimplemented");
468      raise Program_Error with "Unimplemented procedure UML_Interaction_Operand_Proxy.Exclude_Collisions";
469      return Exclude_Collisions (Self, Imps);
470   end Exclude_Collisions;
471
472   -------------------------
473   -- Get_Names_Of_Member --
474   -------------------------
475
476   overriding function Get_Names_Of_Member
477    (Self : not null access constant UML_Interaction_Operand_Proxy;
478     Element : AMF.UML.Named_Elements.UML_Named_Element_Access)
479       return AMF.String_Collections.Set_Of_String is
480   begin
481      --  Generated stub: replace with real body!
482      pragma Compile_Time_Warning (Standard.True, "Get_Names_Of_Member unimplemented");
483      raise Program_Error with "Unimplemented procedure UML_Interaction_Operand_Proxy.Get_Names_Of_Member";
484      return Get_Names_Of_Member (Self, Element);
485   end Get_Names_Of_Member;
486
487   --------------------
488   -- Import_Members --
489   --------------------
490
491   overriding function Import_Members
492    (Self : not null access constant UML_Interaction_Operand_Proxy;
493     Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
494       return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
495   begin
496      --  Generated stub: replace with real body!
497      pragma Compile_Time_Warning (Standard.True, "Import_Members unimplemented");
498      raise Program_Error with "Unimplemented procedure UML_Interaction_Operand_Proxy.Import_Members";
499      return Import_Members (Self, Imps);
500   end Import_Members;
501
502   ---------------------
503   -- Imported_Member --
504   ---------------------
505
506   overriding function Imported_Member
507    (Self : not null access constant UML_Interaction_Operand_Proxy)
508       return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
509   begin
510      --  Generated stub: replace with real body!
511      pragma Compile_Time_Warning (Standard.True, "Imported_Member unimplemented");
512      raise Program_Error with "Unimplemented procedure UML_Interaction_Operand_Proxy.Imported_Member";
513      return Imported_Member (Self);
514   end Imported_Member;
515
516   ---------------------------------
517   -- Members_Are_Distinguishable --
518   ---------------------------------
519
520   overriding function Members_Are_Distinguishable
521    (Self : not null access constant UML_Interaction_Operand_Proxy)
522       return Boolean is
523   begin
524      --  Generated stub: replace with real body!
525      pragma Compile_Time_Warning (Standard.True, "Members_Are_Distinguishable unimplemented");
526      raise Program_Error with "Unimplemented procedure UML_Interaction_Operand_Proxy.Members_Are_Distinguishable";
527      return Members_Are_Distinguishable (Self);
528   end Members_Are_Distinguishable;
529
530   ------------------
531   -- Owned_Member --
532   ------------------
533
534   overriding function Owned_Member
535    (Self : not null access constant UML_Interaction_Operand_Proxy)
536       return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
537   begin
538      --  Generated stub: replace with real body!
539      pragma Compile_Time_Warning (Standard.True, "Owned_Member unimplemented");
540      raise Program_Error with "Unimplemented procedure UML_Interaction_Operand_Proxy.Owned_Member";
541      return Owned_Member (Self);
542   end Owned_Member;
543
544end AMF.Internals.UML_Interaction_Operands;
545