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