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