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_Packageable_Elements;
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_Packages is
67
68   type UML_Package_Proxy is
69     limited new AMF.Internals.UML_Packageable_Elements.UML_Packageable_Element_Proxy
70       and AMF.UML.Packages.UML_Package with null record;
71
72   overriding function Get_URI
73    (Self : not null access constant UML_Package_Proxy)
74       return AMF.Optional_String;
75   --  Getter of Package::URI.
76   --
77   --  Provides an identifier for the package that can be used for many
78   --  purposes. A URI is the universally unique identification of the package
79   --  following the IETF URI specification, RFC 2396
80   --  http://www.ietf.org/rfc/rfc2396.txt and it must comply with those
81   --  syntax rules.
82
83   overriding procedure Set_URI
84    (Self : not null access UML_Package_Proxy;
85     To   : AMF.Optional_String);
86   --  Setter of Package::URI.
87   --
88   --  Provides an identifier for the package that can be used for many
89   --  purposes. A URI is the universally unique identification of the package
90   --  following the IETF URI specification, RFC 2396
91   --  http://www.ietf.org/rfc/rfc2396.txt and it must comply with those
92   --  syntax rules.
93
94   overriding function Get_Nested_Package
95    (Self : not null access constant UML_Package_Proxy)
96       return AMF.UML.Packages.Collections.Set_Of_UML_Package;
97   --  Getter of Package::nestedPackage.
98   --
99   --  References the packaged elements that are Packages.
100
101   overriding function Get_Nesting_Package
102    (Self : not null access constant UML_Package_Proxy)
103       return AMF.UML.Packages.UML_Package_Access;
104   --  Getter of Package::nestingPackage.
105   --
106   --  References the Package that owns this Package.
107
108   overriding procedure Set_Nesting_Package
109    (Self : not null access UML_Package_Proxy;
110     To   : AMF.UML.Packages.UML_Package_Access);
111   --  Setter of Package::nestingPackage.
112   --
113   --  References the Package that owns this Package.
114
115   overriding function Get_Owned_Stereotype
116    (Self : not null access constant UML_Package_Proxy)
117       return AMF.UML.Stereotypes.Collections.Set_Of_UML_Stereotype;
118   --  Getter of Package::ownedStereotype.
119   --
120   --  References the Stereotypes that are owned by the Package
121
122   overriding function Get_Owned_Type
123    (Self : not null access constant UML_Package_Proxy)
124       return AMF.UML.Types.Collections.Set_Of_UML_Type;
125   --  Getter of Package::ownedType.
126   --
127   --  References the packaged elements that are Types.
128
129   overriding function Get_Package_Merge
130    (Self : not null access constant UML_Package_Proxy)
131       return AMF.UML.Package_Merges.Collections.Set_Of_UML_Package_Merge;
132   --  Getter of Package::packageMerge.
133   --
134   --  References the PackageMerges that are owned by this Package.
135
136   overriding function Get_Packaged_Element
137    (Self : not null access constant UML_Package_Proxy)
138       return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
139   --  Getter of Package::packagedElement.
140   --
141   --  Specifies the packageable elements that are owned by this Package.
142
143   overriding function Get_Profile_Application
144    (Self : not null access constant UML_Package_Proxy)
145       return AMF.UML.Profile_Applications.Collections.Set_Of_UML_Profile_Application;
146   --  Getter of Package::profileApplication.
147   --
148   --  References the ProfileApplications that indicate which profiles have
149   --  been applied to the Package.
150
151   overriding function Get_Element_Import
152    (Self : not null access constant UML_Package_Proxy)
153       return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import;
154   --  Getter of Namespace::elementImport.
155   --
156   --  References the ElementImports owned by the Namespace.
157
158   overriding function Get_Imported_Member
159    (Self : not null access constant UML_Package_Proxy)
160       return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
161   --  Getter of Namespace::importedMember.
162   --
163   --  References the PackageableElements that are members of this Namespace
164   --  as a result of either PackageImports or ElementImports.
165
166   overriding function Get_Member
167    (Self : not null access constant UML_Package_Proxy)
168       return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
169   --  Getter of Namespace::member.
170   --
171   --  A collection of NamedElements identifiable within the Namespace, either
172   --  by being owned or by being introduced by importing or inheritance.
173
174   overriding function Get_Owned_Member
175    (Self : not null access constant UML_Package_Proxy)
176       return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
177   --  Getter of Namespace::ownedMember.
178   --
179   --  A collection of NamedElements owned by the Namespace.
180
181   overriding function Get_Owned_Rule
182    (Self : not null access constant UML_Package_Proxy)
183       return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint;
184   --  Getter of Namespace::ownedRule.
185   --
186   --  Specifies a set of Constraints owned by this Namespace.
187
188   overriding function Get_Package_Import
189    (Self : not null access constant UML_Package_Proxy)
190       return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import;
191   --  Getter of Namespace::packageImport.
192   --
193   --  References the PackageImports owned by the Namespace.
194
195   overriding function Get_Client_Dependency
196    (Self : not null access constant UML_Package_Proxy)
197       return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency;
198   --  Getter of NamedElement::clientDependency.
199   --
200   --  Indicates the dependencies that reference the client.
201
202   overriding function Get_Name_Expression
203    (Self : not null access constant UML_Package_Proxy)
204       return AMF.UML.String_Expressions.UML_String_Expression_Access;
205   --  Getter of NamedElement::nameExpression.
206   --
207   --  The string expression used to define the name of this named element.
208
209   overriding procedure Set_Name_Expression
210    (Self : not null access UML_Package_Proxy;
211     To   : AMF.UML.String_Expressions.UML_String_Expression_Access);
212   --  Setter of NamedElement::nameExpression.
213   --
214   --  The string expression used to define the name of this named element.
215
216   overriding function Get_Namespace
217    (Self : not null access constant UML_Package_Proxy)
218       return AMF.UML.Namespaces.UML_Namespace_Access;
219   --  Getter of NamedElement::namespace.
220   --
221   --  Specifies the namespace that owns the NamedElement.
222
223   overriding function Get_Qualified_Name
224    (Self : not null access constant UML_Package_Proxy)
225       return AMF.Optional_String;
226   --  Getter of NamedElement::qualifiedName.
227   --
228   --  A name which allows the NamedElement to be identified within a
229   --  hierarchy of nested Namespaces. It is constructed from the names of the
230   --  containing namespaces starting at the root of the hierarchy and ending
231   --  with the name of the NamedElement itself.
232
233   overriding function Get_Owning_Template_Parameter
234    (Self : not null access constant UML_Package_Proxy)
235       return AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
236   --  Getter of ParameterableElement::owningTemplateParameter.
237   --
238   --  The formal template parameter that owns this element.
239
240   overriding procedure Set_Owning_Template_Parameter
241    (Self : not null access UML_Package_Proxy;
242     To   : AMF.UML.Template_Parameters.UML_Template_Parameter_Access);
243   --  Setter of ParameterableElement::owningTemplateParameter.
244   --
245   --  The formal template parameter that owns this element.
246
247   overriding function Get_Template_Parameter
248    (Self : not null access constant UML_Package_Proxy)
249       return AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
250   --  Getter of ParameterableElement::templateParameter.
251   --
252   --  The template parameter that exposes this element as a formal parameter.
253
254   overriding procedure Set_Template_Parameter
255    (Self : not null access UML_Package_Proxy;
256     To   : AMF.UML.Template_Parameters.UML_Template_Parameter_Access);
257   --  Setter of ParameterableElement::templateParameter.
258   --
259   --  The template parameter that exposes this element as a formal parameter.
260
261   overriding function Get_Owned_Template_Signature
262    (Self : not null access constant UML_Package_Proxy)
263       return AMF.UML.Template_Signatures.UML_Template_Signature_Access;
264   --  Getter of TemplateableElement::ownedTemplateSignature.
265   --
266   --  The optional template signature specifying the formal template
267   --  parameters.
268
269   overriding procedure Set_Owned_Template_Signature
270    (Self : not null access UML_Package_Proxy;
271     To   : AMF.UML.Template_Signatures.UML_Template_Signature_Access);
272   --  Setter of TemplateableElement::ownedTemplateSignature.
273   --
274   --  The optional template signature specifying the formal template
275   --  parameters.
276
277   overriding function Get_Template_Binding
278    (Self : not null access constant UML_Package_Proxy)
279       return AMF.UML.Template_Bindings.Collections.Set_Of_UML_Template_Binding;
280   --  Getter of TemplateableElement::templateBinding.
281   --
282   --  The optional bindings from this element to templates.
283
284   overriding function All_Applicable_Stereotypes
285    (Self : not null access constant UML_Package_Proxy)
286       return AMF.UML.Stereotypes.Collections.Set_Of_UML_Stereotype;
287   --  Operation Package::allApplicableStereotypes.
288   --
289   --  The query allApplicableStereotypes() returns all the directly or
290   --  indirectly owned stereotypes, including stereotypes contained in
291   --  sub-profiles.
292
293   overriding function Containing_Profile
294    (Self : not null access constant UML_Package_Proxy)
295       return AMF.UML.Profiles.UML_Profile_Access;
296   --  Operation Package::containingProfile.
297   --
298   --  The query containingProfile() returns the closest profile directly or
299   --  indirectly containing this package (or this package itself, if it is a
300   --  profile).
301
302   overriding function Makes_Visible
303    (Self : not null access constant UML_Package_Proxy;
304     El : AMF.UML.Named_Elements.UML_Named_Element_Access)
305       return Boolean;
306   --  Operation Package::makesVisible.
307   --
308   --  The query makesVisible() defines whether a Package makes an element
309   --  visible outside itself. Elements with no visibility and elements with
310   --  public visibility are made visible.
311
312   overriding function Must_Be_Owned
313    (Self : not null access constant UML_Package_Proxy)
314       return Boolean;
315   --  Operation Package::mustBeOwned.
316   --
317   --  The query mustBeOwned() indicates whether elements of this type must
318   --  have an owner.
319
320   overriding function Nested_Package
321    (Self : not null access constant UML_Package_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_Package_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_Package_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_Package_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_Package_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_Package_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_Package_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_Package_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_Package_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_Package_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_Package_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_Package_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_Package_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_Package_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_Package_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_Package_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_Package_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_Package_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_Package_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_Package_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_Packages;
499