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