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