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