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.Internals.UML_Packages;
45with AMF.String_Collections;
46with AMF.UML.Constraints.Collections;
47with AMF.UML.Dependencies.Collections;
48with AMF.UML.Element_Imports.Collections;
49with AMF.UML.Named_Elements.Collections;
50with AMF.UML.Namespaces;
51with AMF.UML.Package_Imports.Collections;
52with AMF.UML.Package_Merges.Collections;
53with AMF.UML.Packageable_Elements.Collections;
54with AMF.UML.Packages.Collections;
55with AMF.UML.Parameterable_Elements.Collections;
56with AMF.UML.Profile_Applications.Collections;
57with AMF.UML.Profiles;
58with AMF.UML.Stereotypes.Collections;
59with AMF.UML.String_Expressions;
60with AMF.UML.Template_Bindings.Collections;
61with AMF.UML.Template_Parameters;
62with AMF.UML.Template_Signatures;
63with AMF.UML.Types.Collections;
64with AMF.Visitors;
65
66package AMF.Internals.UML_Profiles is
67
68   type UML_Profile_Proxy is
69     limited new AMF.Internals.UML_Packages.UML_Package_Proxy
70       and AMF.UML.Profiles.UML_Profile with null record;
71
72   overriding function Get_Metaclass_Reference
73    (Self : not null access constant UML_Profile_Proxy)
74       return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import;
75   --  Getter of Profile::metaclassReference.
76   --
77   --  References a metaclass that may be extended.
78
79   overriding function Get_Metamodel_Reference
80    (Self : not null access constant UML_Profile_Proxy)
81       return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import;
82   --  Getter of Profile::metamodelReference.
83   --
84   --  References a package containing (directly or indirectly) metaclasses
85   --  that may be extended.
86
87   overriding function Get_URI
88    (Self : not null access constant UML_Profile_Proxy)
89       return AMF.Optional_String;
90   --  Getter of Package::URI.
91   --
92   --  Provides an identifier for the package that can be used for many
93   --  purposes. A URI is the universally unique identification of the package
94   --  following the IETF URI specification, RFC 2396
95   --  http://www.ietf.org/rfc/rfc2396.txt and it must comply with those
96   --  syntax rules.
97
98   overriding procedure Set_URI
99    (Self : not null access UML_Profile_Proxy;
100     To   : AMF.Optional_String);
101   --  Setter of Package::URI.
102   --
103   --  Provides an identifier for the package that can be used for many
104   --  purposes. A URI is the universally unique identification of the package
105   --  following the IETF URI specification, RFC 2396
106   --  http://www.ietf.org/rfc/rfc2396.txt and it must comply with those
107   --  syntax rules.
108
109   overriding function Get_Nested_Package
110    (Self : not null access constant UML_Profile_Proxy)
111       return AMF.UML.Packages.Collections.Set_Of_UML_Package;
112   --  Getter of Package::nestedPackage.
113   --
114   --  References the packaged elements that are Packages.
115
116   overriding function Get_Nesting_Package
117    (Self : not null access constant UML_Profile_Proxy)
118       return AMF.UML.Packages.UML_Package_Access;
119   --  Getter of Package::nestingPackage.
120   --
121   --  References the Package that owns this Package.
122
123   overriding procedure Set_Nesting_Package
124    (Self : not null access UML_Profile_Proxy;
125     To   : AMF.UML.Packages.UML_Package_Access);
126   --  Setter of Package::nestingPackage.
127   --
128   --  References the Package that owns this Package.
129
130   overriding function Get_Owned_Stereotype
131    (Self : not null access constant UML_Profile_Proxy)
132       return AMF.UML.Stereotypes.Collections.Set_Of_UML_Stereotype;
133   --  Getter of Package::ownedStereotype.
134   --
135   --  References the Stereotypes that are owned by the Package
136
137   overriding function Get_Owned_Type
138    (Self : not null access constant UML_Profile_Proxy)
139       return AMF.UML.Types.Collections.Set_Of_UML_Type;
140   --  Getter of Package::ownedType.
141   --
142   --  References the packaged elements that are Types.
143
144   overriding function Get_Package_Merge
145    (Self : not null access constant UML_Profile_Proxy)
146       return AMF.UML.Package_Merges.Collections.Set_Of_UML_Package_Merge;
147   --  Getter of Package::packageMerge.
148   --
149   --  References the PackageMerges that are owned by this Package.
150
151   overriding function Get_Profile_Application
152    (Self : not null access constant UML_Profile_Proxy)
153       return AMF.UML.Profile_Applications.Collections.Set_Of_UML_Profile_Application;
154   --  Getter of Package::profileApplication.
155   --
156   --  References the ProfileApplications that indicate which profiles have
157   --  been applied to the Package.
158
159   overriding function Get_Element_Import
160    (Self : not null access constant UML_Profile_Proxy)
161       return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import;
162   --  Getter of Namespace::elementImport.
163   --
164   --  References the ElementImports owned by the Namespace.
165
166   overriding function Get_Imported_Member
167    (Self : not null access constant UML_Profile_Proxy)
168       return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
169   --  Getter of Namespace::importedMember.
170   --
171   --  References the PackageableElements that are members of this Namespace
172   --  as a result of either PackageImports or ElementImports.
173
174   overriding function Get_Member
175    (Self : not null access constant UML_Profile_Proxy)
176       return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
177   --  Getter of Namespace::member.
178   --
179   --  A collection of NamedElements identifiable within the Namespace, either
180   --  by being owned or by being introduced by importing or inheritance.
181
182   overriding function Get_Owned_Member
183    (Self : not null access constant UML_Profile_Proxy)
184       return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
185   --  Getter of Namespace::ownedMember.
186   --
187   --  A collection of NamedElements owned by the Namespace.
188
189   overriding function Get_Owned_Rule
190    (Self : not null access constant UML_Profile_Proxy)
191       return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint;
192   --  Getter of Namespace::ownedRule.
193   --
194   --  Specifies a set of Constraints owned by this Namespace.
195
196   overriding function Get_Package_Import
197    (Self : not null access constant UML_Profile_Proxy)
198       return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import;
199   --  Getter of Namespace::packageImport.
200   --
201   --  References the PackageImports owned by the Namespace.
202
203   overriding function Get_Client_Dependency
204    (Self : not null access constant UML_Profile_Proxy)
205       return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency;
206   --  Getter of NamedElement::clientDependency.
207   --
208   --  Indicates the dependencies that reference the client.
209
210   overriding function Get_Name_Expression
211    (Self : not null access constant UML_Profile_Proxy)
212       return AMF.UML.String_Expressions.UML_String_Expression_Access;
213   --  Getter of NamedElement::nameExpression.
214   --
215   --  The string expression used to define the name of this named element.
216
217   overriding procedure Set_Name_Expression
218    (Self : not null access UML_Profile_Proxy;
219     To   : AMF.UML.String_Expressions.UML_String_Expression_Access);
220   --  Setter of NamedElement::nameExpression.
221   --
222   --  The string expression used to define the name of this named element.
223
224   overriding function Get_Namespace
225    (Self : not null access constant UML_Profile_Proxy)
226       return AMF.UML.Namespaces.UML_Namespace_Access;
227   --  Getter of NamedElement::namespace.
228   --
229   --  Specifies the namespace that owns the NamedElement.
230
231   overriding function Get_Qualified_Name
232    (Self : not null access constant UML_Profile_Proxy)
233       return AMF.Optional_String;
234   --  Getter of NamedElement::qualifiedName.
235   --
236   --  A name which allows the NamedElement to be identified within a
237   --  hierarchy of nested Namespaces. It is constructed from the names of the
238   --  containing namespaces starting at the root of the hierarchy and ending
239   --  with the name of the NamedElement itself.
240
241   overriding function Get_Owning_Template_Parameter
242    (Self : not null access constant UML_Profile_Proxy)
243       return AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
244   --  Getter of ParameterableElement::owningTemplateParameter.
245   --
246   --  The formal template parameter that owns this element.
247
248   overriding procedure Set_Owning_Template_Parameter
249    (Self : not null access UML_Profile_Proxy;
250     To   : AMF.UML.Template_Parameters.UML_Template_Parameter_Access);
251   --  Setter of ParameterableElement::owningTemplateParameter.
252   --
253   --  The formal template parameter that owns this element.
254
255   overriding function Get_Template_Parameter
256    (Self : not null access constant UML_Profile_Proxy)
257       return AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
258   --  Getter of ParameterableElement::templateParameter.
259   --
260   --  The template parameter that exposes this element as a formal parameter.
261
262   overriding procedure Set_Template_Parameter
263    (Self : not null access UML_Profile_Proxy;
264     To   : AMF.UML.Template_Parameters.UML_Template_Parameter_Access);
265   --  Setter of ParameterableElement::templateParameter.
266   --
267   --  The template parameter that exposes this element as a formal parameter.
268
269   overriding function Get_Owned_Template_Signature
270    (Self : not null access constant UML_Profile_Proxy)
271       return AMF.UML.Template_Signatures.UML_Template_Signature_Access;
272   --  Getter of TemplateableElement::ownedTemplateSignature.
273   --
274   --  The optional template signature specifying the formal template
275   --  parameters.
276
277   overriding procedure Set_Owned_Template_Signature
278    (Self : not null access UML_Profile_Proxy;
279     To   : AMF.UML.Template_Signatures.UML_Template_Signature_Access);
280   --  Setter of TemplateableElement::ownedTemplateSignature.
281   --
282   --  The optional template signature specifying the formal template
283   --  parameters.
284
285   overriding function Get_Template_Binding
286    (Self : not null access constant UML_Profile_Proxy)
287       return AMF.UML.Template_Bindings.Collections.Set_Of_UML_Template_Binding;
288   --  Getter of TemplateableElement::templateBinding.
289   --
290   --  The optional bindings from this element to templates.
291
292   overriding function All_Applicable_Stereotypes
293    (Self : not null access constant UML_Profile_Proxy)
294       return AMF.UML.Stereotypes.Collections.Set_Of_UML_Stereotype;
295   --  Operation Package::allApplicableStereotypes.
296   --
297   --  The query allApplicableStereotypes() returns all the directly or
298   --  indirectly owned stereotypes, including stereotypes contained in
299   --  sub-profiles.
300
301   overriding function Containing_Profile
302    (Self : not null access constant UML_Profile_Proxy)
303       return AMF.UML.Profiles.UML_Profile_Access;
304   --  Operation Package::containingProfile.
305   --
306   --  The query containingProfile() returns the closest profile directly or
307   --  indirectly containing this package (or this package itself, if it is a
308   --  profile).
309
310   overriding function Makes_Visible
311    (Self : not null access constant UML_Profile_Proxy;
312     El : AMF.UML.Named_Elements.UML_Named_Element_Access)
313       return Boolean;
314   --  Operation Package::makesVisible.
315   --
316   --  The query makesVisible() defines whether a Package makes an element
317   --  visible outside itself. Elements with no visibility and elements with
318   --  public visibility are made visible.
319
320   overriding function Nested_Package
321    (Self : not null access constant UML_Profile_Proxy)
322       return AMF.UML.Packages.Collections.Set_Of_UML_Package;
323   --  Operation Package::nestedPackage.
324   --
325   --  Missing derivation for Package::/nestedPackage : Package
326
327   overriding function Owned_Stereotype
328    (Self : not null access constant UML_Profile_Proxy)
329       return AMF.UML.Stereotypes.Collections.Set_Of_UML_Stereotype;
330   --  Operation Package::ownedStereotype.
331   --
332   --  Missing derivation for Package::/ownedStereotype : Stereotype
333
334   overriding function Owned_Type
335    (Self : not null access constant UML_Profile_Proxy)
336       return AMF.UML.Types.Collections.Set_Of_UML_Type;
337   --  Operation Package::ownedType.
338   --
339   --  Missing derivation for Package::/ownedType : Type
340
341   overriding function Visible_Members
342    (Self : not null access constant UML_Profile_Proxy)
343       return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
344   --  Operation Package::visibleMembers.
345   --
346   --  The query visibleMembers() defines which members of a Package can be
347   --  accessed outside it.
348
349   overriding function Exclude_Collisions
350    (Self : not null access constant UML_Profile_Proxy;
351     Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
352       return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
353   --  Operation Namespace::excludeCollisions.
354   --
355   --  The query excludeCollisions() excludes from a set of
356   --  PackageableElements any that would not be distinguishable from each
357   --  other in this namespace.
358
359   overriding function Get_Names_Of_Member
360    (Self : not null access constant UML_Profile_Proxy;
361     Element : AMF.UML.Named_Elements.UML_Named_Element_Access)
362       return AMF.String_Collections.Set_Of_String;
363   --  Operation Namespace::getNamesOfMember.
364   --
365   --  The query getNamesOfMember() takes importing into account. It gives
366   --  back the set of names that an element would have in an importing
367   --  namespace, either because it is owned, or if not owned then imported
368   --  individually, or if not individually then from a package.
369   --  The query getNamesOfMember() gives a set of all of the names that a
370   --  member would have in a Namespace. In general a member can have multiple
371   --  names in a Namespace if it is imported more than once with different
372   --  aliases. The query takes account of importing. It gives back the set of
373   --  names that an element would have in an importing namespace, either
374   --  because it is owned, or if not owned then imported individually, or if
375   --  not individually then from a package.
376
377   overriding function Import_Members
378    (Self : not null access constant UML_Profile_Proxy;
379     Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
380       return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
381   --  Operation Namespace::importMembers.
382   --
383   --  The query importMembers() defines which of a set of PackageableElements
384   --  are actually imported into the namespace. This excludes hidden ones,
385   --  i.e., those which have names that conflict with names of owned members,
386   --  and also excludes elements which would have the same name when imported.
387
388   overriding function Imported_Member
389    (Self : not null access constant UML_Profile_Proxy)
390       return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
391   --  Operation Namespace::importedMember.
392   --
393   --  The importedMember property is derived from the ElementImports and the
394   --  PackageImports. References the PackageableElements that are members of
395   --  this Namespace as a result of either PackageImports or ElementImports.
396
397   overriding function Members_Are_Distinguishable
398    (Self : not null access constant UML_Profile_Proxy)
399       return Boolean;
400   --  Operation Namespace::membersAreDistinguishable.
401   --
402   --  The Boolean query membersAreDistinguishable() determines whether all of
403   --  the namespace's members are distinguishable within it.
404
405   overriding function Owned_Member
406    (Self : not null access constant UML_Profile_Proxy)
407       return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
408   --  Operation Namespace::ownedMember.
409   --
410   --  Missing derivation for Namespace::/ownedMember : NamedElement
411
412   overriding function All_Owning_Packages
413    (Self : not null access constant UML_Profile_Proxy)
414       return AMF.UML.Packages.Collections.Set_Of_UML_Package;
415   --  Operation NamedElement::allOwningPackages.
416   --
417   --  The query allOwningPackages() returns all the directly or indirectly
418   --  owning packages.
419
420   overriding function Is_Distinguishable_From
421    (Self : not null access constant UML_Profile_Proxy;
422     N : AMF.UML.Named_Elements.UML_Named_Element_Access;
423     Ns : AMF.UML.Namespaces.UML_Namespace_Access)
424       return Boolean;
425   --  Operation NamedElement::isDistinguishableFrom.
426   --
427   --  The query isDistinguishableFrom() determines whether two NamedElements
428   --  may logically co-exist within a Namespace. By default, two named
429   --  elements are distinguishable if (a) they have unrelated types or (b)
430   --  they have related types but different names.
431
432   overriding function Namespace
433    (Self : not null access constant UML_Profile_Proxy)
434       return AMF.UML.Namespaces.UML_Namespace_Access;
435   --  Operation NamedElement::namespace.
436   --
437   --  Missing derivation for NamedElement::/namespace : Namespace
438
439   overriding function Is_Compatible_With
440    (Self : not null access constant UML_Profile_Proxy;
441     P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
442       return Boolean;
443   --  Operation ParameterableElement::isCompatibleWith.
444   --
445   --  The query isCompatibleWith() determines if this parameterable element
446   --  is compatible with the specified parameterable element. By default
447   --  parameterable element P is compatible with parameterable element Q if
448   --  the kind of P is the same or a subtype as the kind of Q. Subclasses
449   --  should override this operation to specify different compatibility
450   --  constraints.
451
452   overriding function Is_Template_Parameter
453    (Self : not null access constant UML_Profile_Proxy)
454       return Boolean;
455   --  Operation ParameterableElement::isTemplateParameter.
456   --
457   --  The query isTemplateParameter() determines if this parameterable
458   --  element is exposed as a formal template parameter.
459
460   overriding function Is_Template
461    (Self : not null access constant UML_Profile_Proxy)
462       return Boolean;
463   --  Operation TemplateableElement::isTemplate.
464   --
465   --  The query isTemplate() returns whether this templateable element is
466   --  actually a template.
467
468   overriding function Parameterable_Elements
469    (Self : not null access constant UML_Profile_Proxy)
470       return AMF.UML.Parameterable_Elements.Collections.Set_Of_UML_Parameterable_Element;
471   --  Operation TemplateableElement::parameterableElements.
472   --
473   --  The query parameterableElements() returns the set of elements that may
474   --  be used as the parametered elements for a template parameter of this
475   --  templateable element. By default, this set includes all the owned
476   --  elements. Subclasses may override this operation if they choose to
477   --  restrict the set of parameterable elements.
478
479   overriding procedure Enter_Element
480    (Self    : not null access constant UML_Profile_Proxy;
481     Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
482     Control : in out AMF.Visitors.Traverse_Control);
483   --  Dispatch call to corresponding subprogram of visitor interface.
484
485   overriding procedure Leave_Element
486    (Self    : not null access constant UML_Profile_Proxy;
487     Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
488     Control : in out AMF.Visitors.Traverse_Control);
489   --  Dispatch call to corresponding subprogram of visitor interface.
490
491   overriding procedure Visit_Element
492    (Self     : not null access constant UML_Profile_Proxy;
493     Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
494     Visitor  : in out AMF.Visitors.Abstract_Visitor'Class;
495     Control  : in out AMF.Visitors.Traverse_Control);
496   --  Dispatch call to corresponding subprogram of iterator interface.
497
498end AMF.Internals.UML_Profiles;
499