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