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