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_Behavior_Execution_Specifications is
54
55   -------------------
56   -- Enter_Element --
57   -------------------
58
59   overriding procedure Enter_Element
60    (Self    : not null access constant UML_Behavior_Execution_Specification_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_Behavior_Execution_Specification
67            (AMF.UML.Behavior_Execution_Specifications.UML_Behavior_Execution_Specification_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_Behavior_Execution_Specification_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_Behavior_Execution_Specification
84            (AMF.UML.Behavior_Execution_Specifications.UML_Behavior_Execution_Specification_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_Behavior_Execution_Specification_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_Behavior_Execution_Specification
102            (Visitor,
103             AMF.UML.Behavior_Execution_Specifications.UML_Behavior_Execution_Specification_Access (Self),
104             Control);
105      end if;
106   end Visit_Element;
107
108   ------------------
109   -- Get_Behavior --
110   ------------------
111
112   overriding function Get_Behavior
113    (Self : not null access constant UML_Behavior_Execution_Specification_Proxy)
114       return AMF.UML.Behaviors.UML_Behavior_Access is
115   begin
116      return
117        AMF.UML.Behaviors.UML_Behavior_Access
118         (AMF.Internals.Helpers.To_Element
119           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Behavior
120             (Self.Element)));
121   end Get_Behavior;
122
123   ------------------
124   -- Set_Behavior --
125   ------------------
126
127   overriding procedure Set_Behavior
128    (Self : not null access UML_Behavior_Execution_Specification_Proxy;
129     To   : AMF.UML.Behaviors.UML_Behavior_Access) is
130   begin
131      AMF.Internals.Tables.UML_Attributes.Internal_Set_Behavior
132       (Self.Element,
133        AMF.Internals.Helpers.To_Element
134         (AMF.Elements.Element_Access (To)));
135   end Set_Behavior;
136
137   ----------------
138   -- Get_Finish --
139   ----------------
140
141   overriding function Get_Finish
142    (Self : not null access constant UML_Behavior_Execution_Specification_Proxy)
143       return AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access is
144   begin
145      return
146        AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access
147         (AMF.Internals.Helpers.To_Element
148           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Finish
149             (Self.Element)));
150   end Get_Finish;
151
152   ----------------
153   -- Set_Finish --
154   ----------------
155
156   overriding procedure Set_Finish
157    (Self : not null access UML_Behavior_Execution_Specification_Proxy;
158     To   : AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access) is
159   begin
160      AMF.Internals.Tables.UML_Attributes.Internal_Set_Finish
161       (Self.Element,
162        AMF.Internals.Helpers.To_Element
163         (AMF.Elements.Element_Access (To)));
164   end Set_Finish;
165
166   ---------------
167   -- Get_Start --
168   ---------------
169
170   overriding function Get_Start
171    (Self : not null access constant UML_Behavior_Execution_Specification_Proxy)
172       return AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access is
173   begin
174      return
175        AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access
176         (AMF.Internals.Helpers.To_Element
177           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Start
178             (Self.Element)));
179   end Get_Start;
180
181   ---------------
182   -- Set_Start --
183   ---------------
184
185   overriding procedure Set_Start
186    (Self : not null access UML_Behavior_Execution_Specification_Proxy;
187     To   : AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access) is
188   begin
189      AMF.Internals.Tables.UML_Attributes.Internal_Set_Start
190       (Self.Element,
191        AMF.Internals.Helpers.To_Element
192         (AMF.Elements.Element_Access (To)));
193   end Set_Start;
194
195   -----------------
196   -- Get_Covered --
197   -----------------
198
199   overriding function Get_Covered
200    (Self : not null access constant UML_Behavior_Execution_Specification_Proxy)
201       return AMF.UML.Lifelines.Collections.Set_Of_UML_Lifeline is
202   begin
203      return
204        AMF.UML.Lifelines.Collections.Wrap
205         (AMF.Internals.Element_Collections.Wrap
206           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Covered
207             (Self.Element)));
208   end Get_Covered;
209
210   -------------------------------
211   -- Get_Enclosing_Interaction --
212   -------------------------------
213
214   overriding function Get_Enclosing_Interaction
215    (Self : not null access constant UML_Behavior_Execution_Specification_Proxy)
216       return AMF.UML.Interactions.UML_Interaction_Access is
217   begin
218      return
219        AMF.UML.Interactions.UML_Interaction_Access
220         (AMF.Internals.Helpers.To_Element
221           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Enclosing_Interaction
222             (Self.Element)));
223   end Get_Enclosing_Interaction;
224
225   -------------------------------
226   -- Set_Enclosing_Interaction --
227   -------------------------------
228
229   overriding procedure Set_Enclosing_Interaction
230    (Self : not null access UML_Behavior_Execution_Specification_Proxy;
231     To   : AMF.UML.Interactions.UML_Interaction_Access) is
232   begin
233      AMF.Internals.Tables.UML_Attributes.Internal_Set_Enclosing_Interaction
234       (Self.Element,
235        AMF.Internals.Helpers.To_Element
236         (AMF.Elements.Element_Access (To)));
237   end Set_Enclosing_Interaction;
238
239   ---------------------------
240   -- Get_Enclosing_Operand --
241   ---------------------------
242
243   overriding function Get_Enclosing_Operand
244    (Self : not null access constant UML_Behavior_Execution_Specification_Proxy)
245       return AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access is
246   begin
247      return
248        AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access
249         (AMF.Internals.Helpers.To_Element
250           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Enclosing_Operand
251             (Self.Element)));
252   end Get_Enclosing_Operand;
253
254   ---------------------------
255   -- Set_Enclosing_Operand --
256   ---------------------------
257
258   overriding procedure Set_Enclosing_Operand
259    (Self : not null access UML_Behavior_Execution_Specification_Proxy;
260     To   : AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access) is
261   begin
262      AMF.Internals.Tables.UML_Attributes.Internal_Set_Enclosing_Operand
263       (Self.Element,
264        AMF.Internals.Helpers.To_Element
265         (AMF.Elements.Element_Access (To)));
266   end Set_Enclosing_Operand;
267
268   --------------------------
269   -- Get_General_Ordering --
270   --------------------------
271
272   overriding function Get_General_Ordering
273    (Self : not null access constant UML_Behavior_Execution_Specification_Proxy)
274       return AMF.UML.General_Orderings.Collections.Set_Of_UML_General_Ordering is
275   begin
276      return
277        AMF.UML.General_Orderings.Collections.Wrap
278         (AMF.Internals.Element_Collections.Wrap
279           (AMF.Internals.Tables.UML_Attributes.Internal_Get_General_Ordering
280             (Self.Element)));
281   end Get_General_Ordering;
282
283   ---------------------------
284   -- Get_Client_Dependency --
285   ---------------------------
286
287   overriding function Get_Client_Dependency
288    (Self : not null access constant UML_Behavior_Execution_Specification_Proxy)
289       return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
290   begin
291      return
292        AMF.UML.Dependencies.Collections.Wrap
293         (AMF.Internals.Element_Collections.Wrap
294           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
295             (Self.Element)));
296   end Get_Client_Dependency;
297
298   -------------------------
299   -- Get_Name_Expression --
300   -------------------------
301
302   overriding function Get_Name_Expression
303    (Self : not null access constant UML_Behavior_Execution_Specification_Proxy)
304       return AMF.UML.String_Expressions.UML_String_Expression_Access is
305   begin
306      return
307        AMF.UML.String_Expressions.UML_String_Expression_Access
308         (AMF.Internals.Helpers.To_Element
309           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
310             (Self.Element)));
311   end Get_Name_Expression;
312
313   -------------------------
314   -- Set_Name_Expression --
315   -------------------------
316
317   overriding procedure Set_Name_Expression
318    (Self : not null access UML_Behavior_Execution_Specification_Proxy;
319     To   : AMF.UML.String_Expressions.UML_String_Expression_Access) is
320   begin
321      AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
322       (Self.Element,
323        AMF.Internals.Helpers.To_Element
324         (AMF.Elements.Element_Access (To)));
325   end Set_Name_Expression;
326
327   -------------------
328   -- Get_Namespace --
329   -------------------
330
331   overriding function Get_Namespace
332    (Self : not null access constant UML_Behavior_Execution_Specification_Proxy)
333       return AMF.UML.Namespaces.UML_Namespace_Access is
334   begin
335      return
336        AMF.UML.Namespaces.UML_Namespace_Access
337         (AMF.Internals.Helpers.To_Element
338           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
339             (Self.Element)));
340   end Get_Namespace;
341
342   ------------------------
343   -- Get_Qualified_Name --
344   ------------------------
345
346   overriding function Get_Qualified_Name
347    (Self : not null access constant UML_Behavior_Execution_Specification_Proxy)
348       return AMF.Optional_String is
349   begin
350      declare
351         use type Matreshka.Internals.Strings.Shared_String_Access;
352
353         Aux : constant Matreshka.Internals.Strings.Shared_String_Access
354           := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
355
356      begin
357         if Aux = null then
358            return (Is_Empty => True);
359
360         else
361            return (False, League.Strings.Internals.Create (Aux));
362         end if;
363      end;
364   end Get_Qualified_Name;
365
366   -------------------------
367   -- All_Owning_Packages --
368   -------------------------
369
370   overriding function All_Owning_Packages
371    (Self : not null access constant UML_Behavior_Execution_Specification_Proxy)
372       return AMF.UML.Packages.Collections.Set_Of_UML_Package is
373   begin
374      --  Generated stub: replace with real body!
375      pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
376      raise Program_Error with "Unimplemented procedure UML_Behavior_Execution_Specification_Proxy.All_Owning_Packages";
377      return All_Owning_Packages (Self);
378   end All_Owning_Packages;
379
380   -----------------------------
381   -- Is_Distinguishable_From --
382   -----------------------------
383
384   overriding function Is_Distinguishable_From
385    (Self : not null access constant UML_Behavior_Execution_Specification_Proxy;
386     N : AMF.UML.Named_Elements.UML_Named_Element_Access;
387     Ns : AMF.UML.Namespaces.UML_Namespace_Access)
388       return Boolean is
389   begin
390      --  Generated stub: replace with real body!
391      pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
392      raise Program_Error with "Unimplemented procedure UML_Behavior_Execution_Specification_Proxy.Is_Distinguishable_From";
393      return Is_Distinguishable_From (Self, N, Ns);
394   end Is_Distinguishable_From;
395
396   ---------------
397   -- Namespace --
398   ---------------
399
400   overriding function Namespace
401    (Self : not null access constant UML_Behavior_Execution_Specification_Proxy)
402       return AMF.UML.Namespaces.UML_Namespace_Access is
403   begin
404      --  Generated stub: replace with real body!
405      pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
406      raise Program_Error with "Unimplemented procedure UML_Behavior_Execution_Specification_Proxy.Namespace";
407      return Namespace (Self);
408   end Namespace;
409
410end AMF.Internals.UML_Behavior_Execution_Specifications;
411