1------------------------------------------------------------------------------
2--                                                                          --
3--                            Matreshka Project                             --
4--                                                                          --
5--                          Ada Modeling Framework                          --
6--                                                                          --
7--                        Runtime Library Component                         --
8--                                                                          --
9------------------------------------------------------------------------------
10--                                                                          --
11-- Copyright © 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: 3432 $ $Date: 2012-11-14 00:51:21 +0400 (Wed, 14 Nov 2012) $
43------------------------------------------------------------------------------
44with AMF.Elements;
45with AMF.Internals.Helpers;
46with AMF.Internals.Tables.UML_Attributes;
47with AMF.Visitors.UMLDI_Iterators;
48with AMF.Visitors.UMLDI_Visitors;
49
50package body AMF.Internals.UMLDI_UML_Edges is
51
52   ----------------
53   -- Get_Source --
54   ----------------
55
56   overriding function Get_Source
57    (Self : not null access constant UMLDI_UML_Edge_Proxy)
58       return AMF.UMLDI.UML_Diagram_Elements.UMLDI_UML_Diagram_Element_Access is
59   begin
60      return
61        AMF.UMLDI.UML_Diagram_Elements.UMLDI_UML_Diagram_Element_Access
62         (AMF.Internals.Helpers.To_Element
63           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Source
64             (Self.Element)));
65   end Get_Source;
66
67   ----------------
68   -- Set_Source --
69   ----------------
70
71   overriding procedure Set_Source
72    (Self : not null access UMLDI_UML_Edge_Proxy;
73     To   : AMF.UMLDI.UML_Diagram_Elements.UMLDI_UML_Diagram_Element_Access) is
74   begin
75      AMF.Internals.Tables.UML_Attributes.Internal_Set_Source
76       (Self.Element,
77        AMF.Internals.Helpers.To_Element
78         (AMF.Elements.Element_Access (To)));
79   end Set_Source;
80
81   ----------------
82   -- Get_Target --
83   ----------------
84
85   overriding function Get_Target
86    (Self : not null access constant UMLDI_UML_Edge_Proxy)
87       return AMF.UMLDI.UML_Diagram_Elements.UMLDI_UML_Diagram_Element_Access is
88   begin
89      return
90        AMF.UMLDI.UML_Diagram_Elements.UMLDI_UML_Diagram_Element_Access
91         (AMF.Internals.Helpers.To_Element
92           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Target
93             (Self.Element)));
94   end Get_Target;
95
96   ----------------
97   -- Set_Target --
98   ----------------
99
100   overriding procedure Set_Target
101    (Self : not null access UMLDI_UML_Edge_Proxy;
102     To   : AMF.UMLDI.UML_Diagram_Elements.UMLDI_UML_Diagram_Element_Access) is
103   begin
104      AMF.Internals.Tables.UML_Attributes.Internal_Set_Target
105       (Self.Element,
106        AMF.Internals.Helpers.To_Element
107         (AMF.Elements.Element_Access (To)));
108   end Set_Target;
109
110   -----------------
111   -- Get_Is_Icon --
112   -----------------
113
114   overriding function Get_Is_Icon
115    (Self : not null access constant UMLDI_UML_Edge_Proxy)
116       return Boolean is
117   begin
118      return
119        AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Icon
120         (Self.Element);
121   end Get_Is_Icon;
122
123   -----------------
124   -- Set_Is_Icon --
125   -----------------
126
127   overriding procedure Set_Is_Icon
128    (Self : not null access UMLDI_UML_Edge_Proxy;
129     To   : Boolean) is
130   begin
131      AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Icon
132       (Self.Element, To);
133   end Set_Is_Icon;
134
135   ---------------------
136   -- Get_Local_Style --
137   ---------------------
138
139   overriding function Get_Local_Style
140    (Self : not null access constant UMLDI_UML_Edge_Proxy)
141       return AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access is
142   begin
143      return
144        AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access
145         (AMF.Internals.Helpers.To_Element
146           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Style
147             (Self.Element)));
148   end Get_Local_Style;
149
150   ---------------------
151   -- Set_Local_Style --
152   ---------------------
153
154   overriding procedure Set_Local_Style
155    (Self : not null access UMLDI_UML_Edge_Proxy;
156     To   : AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access) is
157   begin
158      AMF.Internals.Tables.UML_Attributes.Internal_Set_Local_Style
159       (Self.Element,
160        AMF.Internals.Helpers.To_Element
161         (AMF.Elements.Element_Access (To)));
162   end Set_Local_Style;
163
164   -----------------------
165   -- Get_Model_Element --
166   -----------------------
167
168   overriding function Get_Model_Element
169    (Self : not null access constant UMLDI_UML_Edge_Proxy)
170       return AMF.UML.Elements.Collections.Set_Of_UML_Element is
171   begin
172      raise Program_Error;
173      return X : AMF.UML.Elements.Collections.Set_Of_UML_Element;
174--      return
175--        AMF.UML.Elements.Collections.Wrap
176--         (AMF.Internals.Element_Collections.Wrap
177--           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Model_Element
178--             (Self.Element)));
179   end Get_Model_Element;
180
181   -----------------------
182   -- Get_Model_Element --
183   -----------------------
184
185   overriding function Get_Model_Element
186    (Self : not null access constant UMLDI_UML_Edge_Proxy)
187       return AMF.CMOF.Elements.CMOF_Element_Access is
188   begin
189      return
190        AMF.CMOF.Elements.CMOF_Element_Access
191         (AMF.Internals.Helpers.To_Element
192           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Model_Element
193             (Self.Element)));
194   end Get_Model_Element;
195
196   ---------------------
197   -- Get_Local_Style --
198   ---------------------
199
200   overriding function Get_Local_Style
201    (Self : not null access constant UMLDI_UML_Edge_Proxy)
202       return AMF.DI.Styles.DI_Style_Access is
203   begin
204      return
205        AMF.DI.Styles.DI_Style_Access
206         (AMF.Internals.Helpers.To_Element
207           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Style
208             (Self.Element)));
209   end Get_Local_Style;
210
211   ---------------------
212   -- Set_Local_Style --
213   ---------------------
214
215   overriding procedure Set_Local_Style
216    (Self : not null access UMLDI_UML_Edge_Proxy;
217     To   : AMF.DI.Styles.DI_Style_Access) is
218   begin
219      AMF.Internals.Tables.UML_Attributes.Internal_Set_Local_Style
220       (Self.Element,
221        AMF.Internals.Helpers.To_Element
222         (AMF.Elements.Element_Access (To)));
223   end Set_Local_Style;
224
225   ----------------
226   -- Get_Source --
227   ----------------
228
229   overriding function Get_Source
230    (Self : not null access constant UMLDI_UML_Edge_Proxy)
231       return AMF.DI.Diagram_Elements.DI_Diagram_Element_Access is
232   begin
233      return
234        AMF.DI.Diagram_Elements.DI_Diagram_Element_Access
235         (AMF.Internals.Helpers.To_Element
236           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Source
237             (Self.Element)));
238   end Get_Source;
239
240   ----------------
241   -- Get_Target --
242   ----------------
243
244   overriding function Get_Target
245    (Self : not null access constant UMLDI_UML_Edge_Proxy)
246       return AMF.DI.Diagram_Elements.DI_Diagram_Element_Access is
247   begin
248      return
249        AMF.DI.Diagram_Elements.DI_Diagram_Element_Access
250         (AMF.Internals.Helpers.To_Element
251           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Target
252             (Self.Element)));
253   end Get_Target;
254
255   ------------------
256   -- Get_Waypoint --
257   ------------------
258
259   overriding function Get_Waypoint
260    (Self : not null access constant UMLDI_UML_Edge_Proxy)
261       return AMF.DC.Sequence_Of_DC_Point is
262   begin
263      return
264        AMF.Internals.Tables.UML_Attributes.Internal_Get_Waypoint
265         (Self.Element);
266   end Get_Waypoint;
267
268   -------------------
269   -- Enter_Element --
270   -------------------
271
272   overriding procedure Enter_Element
273    (Self    : not null access constant UMLDI_UML_Edge_Proxy;
274     Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
275     Control : in out AMF.Visitors.Traverse_Control) is
276   begin
277      if Visitor in AMF.Visitors.UMLDI_Visitors.UMLDI_Visitor'Class then
278         AMF.Visitors.UMLDI_Visitors.UMLDI_Visitor'Class
279          (Visitor).Enter_UML_Edge
280            (AMF.UMLDI.UML_Edges.UMLDI_UML_Edge_Access (Self),
281           Control);
282      end if;
283   end Enter_Element;
284
285   -------------------
286   -- Leave_Element --
287   -------------------
288
289   overriding procedure Leave_Element
290    (Self    : not null access constant UMLDI_UML_Edge_Proxy;
291     Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
292     Control : in out AMF.Visitors.Traverse_Control) is
293   begin
294      if Visitor in AMF.Visitors.UMLDI_Visitors.UMLDI_Visitor'Class then
295         AMF.Visitors.UMLDI_Visitors.UMLDI_Visitor'Class
296          (Visitor).Leave_UML_Edge
297            (AMF.UMLDI.UML_Edges.UMLDI_UML_Edge_Access (Self),
298           Control);
299      end if;
300   end Leave_Element;
301
302   -------------------
303   -- Visit_Element --
304   -------------------
305
306   overriding procedure Visit_Element
307    (Self     : not null access constant UMLDI_UML_Edge_Proxy;
308     Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
309     Visitor  : in out AMF.Visitors.Abstract_Visitor'Class;
310     Control  : in out AMF.Visitors.Traverse_Control) is
311   begin
312      if Iterator in AMF.Visitors.UMLDI_Iterators.UMLDI_Iterator'Class then
313         AMF.Visitors.UMLDI_Iterators.UMLDI_Iterator'Class
314          (Iterator).Visit_UML_Edge
315            (Visitor,
316             AMF.UMLDI.UML_Edges.UMLDI_UML_Edge_Access (Self),
317           Control);
318      end if;
319   end Visit_Element;
320
321end AMF.Internals.UMLDI_UML_Edges;
322