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_Duration_Observations is
54
55   -------------------
56   -- Enter_Element --
57   -------------------
58
59   overriding procedure Enter_Element
60    (Self    : not null access constant UML_Duration_Observation_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_Duration_Observation
67            (AMF.UML.Duration_Observations.UML_Duration_Observation_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_Duration_Observation_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_Duration_Observation
84            (AMF.UML.Duration_Observations.UML_Duration_Observation_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_Duration_Observation_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_Duration_Observation
102            (Visitor,
103             AMF.UML.Duration_Observations.UML_Duration_Observation_Access (Self),
104             Control);
105      end if;
106   end Visit_Element;
107
108   ---------------
109   -- Get_Event --
110   ---------------
111
112   overriding function Get_Event
113    (Self : not null access constant UML_Duration_Observation_Proxy)
114       return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
115   begin
116      return
117        AMF.UML.Named_Elements.Collections.Wrap
118         (AMF.Internals.Element_Collections.Wrap
119           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Event
120             (Self.Element)));
121   end Get_Event;
122
123   ---------------------
124   -- Get_First_Event --
125   ---------------------
126
127   overriding function Get_First_Event
128    (Self : not null access constant UML_Duration_Observation_Proxy)
129       return AMF.Boolean_Collections.Set_Of_Boolean is
130   begin
131      raise Program_Error;
132      return Get_First_Event (Self);
133   end Get_First_Event;
134
135   ---------------------------
136   -- Get_Client_Dependency --
137   ---------------------------
138
139   overriding function Get_Client_Dependency
140    (Self : not null access constant UML_Duration_Observation_Proxy)
141       return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
142   begin
143      return
144        AMF.UML.Dependencies.Collections.Wrap
145         (AMF.Internals.Element_Collections.Wrap
146           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
147             (Self.Element)));
148   end Get_Client_Dependency;
149
150   -------------------------
151   -- Get_Name_Expression --
152   -------------------------
153
154   overriding function Get_Name_Expression
155    (Self : not null access constant UML_Duration_Observation_Proxy)
156       return AMF.UML.String_Expressions.UML_String_Expression_Access is
157   begin
158      return
159        AMF.UML.String_Expressions.UML_String_Expression_Access
160         (AMF.Internals.Helpers.To_Element
161           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
162             (Self.Element)));
163   end Get_Name_Expression;
164
165   -------------------------
166   -- Set_Name_Expression --
167   -------------------------
168
169   overriding procedure Set_Name_Expression
170    (Self : not null access UML_Duration_Observation_Proxy;
171     To   : AMF.UML.String_Expressions.UML_String_Expression_Access) is
172   begin
173      AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
174       (Self.Element,
175        AMF.Internals.Helpers.To_Element
176         (AMF.Elements.Element_Access (To)));
177   end Set_Name_Expression;
178
179   -------------------
180   -- Get_Namespace --
181   -------------------
182
183   overriding function Get_Namespace
184    (Self : not null access constant UML_Duration_Observation_Proxy)
185       return AMF.UML.Namespaces.UML_Namespace_Access is
186   begin
187      return
188        AMF.UML.Namespaces.UML_Namespace_Access
189         (AMF.Internals.Helpers.To_Element
190           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
191             (Self.Element)));
192   end Get_Namespace;
193
194   ------------------------
195   -- Get_Qualified_Name --
196   ------------------------
197
198   overriding function Get_Qualified_Name
199    (Self : not null access constant UML_Duration_Observation_Proxy)
200       return AMF.Optional_String is
201   begin
202      declare
203         use type Matreshka.Internals.Strings.Shared_String_Access;
204
205         Aux : constant Matreshka.Internals.Strings.Shared_String_Access
206           := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
207
208      begin
209         if Aux = null then
210            return (Is_Empty => True);
211
212         else
213            return (False, League.Strings.Internals.Create (Aux));
214         end if;
215      end;
216   end Get_Qualified_Name;
217
218   -----------------------------------
219   -- Get_Owning_Template_Parameter --
220   -----------------------------------
221
222   overriding function Get_Owning_Template_Parameter
223    (Self : not null access constant UML_Duration_Observation_Proxy)
224       return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
225   begin
226      return
227        AMF.UML.Template_Parameters.UML_Template_Parameter_Access
228         (AMF.Internals.Helpers.To_Element
229           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter
230             (Self.Element)));
231   end Get_Owning_Template_Parameter;
232
233   -----------------------------------
234   -- Set_Owning_Template_Parameter --
235   -----------------------------------
236
237   overriding procedure Set_Owning_Template_Parameter
238    (Self : not null access UML_Duration_Observation_Proxy;
239     To   : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
240   begin
241      AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter
242       (Self.Element,
243        AMF.Internals.Helpers.To_Element
244         (AMF.Elements.Element_Access (To)));
245   end Set_Owning_Template_Parameter;
246
247   ----------------------------
248   -- Get_Template_Parameter --
249   ----------------------------
250
251   overriding function Get_Template_Parameter
252    (Self : not null access constant UML_Duration_Observation_Proxy)
253       return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
254   begin
255      return
256        AMF.UML.Template_Parameters.UML_Template_Parameter_Access
257         (AMF.Internals.Helpers.To_Element
258           (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter
259             (Self.Element)));
260   end Get_Template_Parameter;
261
262   ----------------------------
263   -- Set_Template_Parameter --
264   ----------------------------
265
266   overriding procedure Set_Template_Parameter
267    (Self : not null access UML_Duration_Observation_Proxy;
268     To   : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
269   begin
270      AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter
271       (Self.Element,
272        AMF.Internals.Helpers.To_Element
273         (AMF.Elements.Element_Access (To)));
274   end Set_Template_Parameter;
275
276   -------------------------
277   -- All_Owning_Packages --
278   -------------------------
279
280   overriding function All_Owning_Packages
281    (Self : not null access constant UML_Duration_Observation_Proxy)
282       return AMF.UML.Packages.Collections.Set_Of_UML_Package is
283   begin
284      --  Generated stub: replace with real body!
285      pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
286      raise Program_Error with "Unimplemented procedure UML_Duration_Observation_Proxy.All_Owning_Packages";
287      return All_Owning_Packages (Self);
288   end All_Owning_Packages;
289
290   -----------------------------
291   -- Is_Distinguishable_From --
292   -----------------------------
293
294   overriding function Is_Distinguishable_From
295    (Self : not null access constant UML_Duration_Observation_Proxy;
296     N : AMF.UML.Named_Elements.UML_Named_Element_Access;
297     Ns : AMF.UML.Namespaces.UML_Namespace_Access)
298       return Boolean is
299   begin
300      --  Generated stub: replace with real body!
301      pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
302      raise Program_Error with "Unimplemented procedure UML_Duration_Observation_Proxy.Is_Distinguishable_From";
303      return Is_Distinguishable_From (Self, N, Ns);
304   end Is_Distinguishable_From;
305
306   ---------------
307   -- Namespace --
308   ---------------
309
310   overriding function Namespace
311    (Self : not null access constant UML_Duration_Observation_Proxy)
312       return AMF.UML.Namespaces.UML_Namespace_Access is
313   begin
314      --  Generated stub: replace with real body!
315      pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
316      raise Program_Error with "Unimplemented procedure UML_Duration_Observation_Proxy.Namespace";
317      return Namespace (Self);
318   end Namespace;
319
320   ------------------------
321   -- Is_Compatible_With --
322   ------------------------
323
324   overriding function Is_Compatible_With
325    (Self : not null access constant UML_Duration_Observation_Proxy;
326     P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
327       return Boolean is
328   begin
329      --  Generated stub: replace with real body!
330      pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented");
331      raise Program_Error with "Unimplemented procedure UML_Duration_Observation_Proxy.Is_Compatible_With";
332      return Is_Compatible_With (Self, P);
333   end Is_Compatible_With;
334
335   ---------------------------
336   -- Is_Template_Parameter --
337   ---------------------------
338
339   overriding function Is_Template_Parameter
340    (Self : not null access constant UML_Duration_Observation_Proxy)
341       return Boolean is
342   begin
343      --  Generated stub: replace with real body!
344      pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented");
345      raise Program_Error with "Unimplemented procedure UML_Duration_Observation_Proxy.Is_Template_Parameter";
346      return Is_Template_Parameter (Self);
347   end Is_Template_Parameter;
348
349end AMF.Internals.UML_Duration_Observations;
350