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