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_Named_Elements;
45with AMF.String_Collections;
46with AMF.UML.Classifiers.Collections;
47with AMF.UML.Constraints.Collections;
48with AMF.UML.Dependencies.Collections;
49with AMF.UML.Element_Imports.Collections;
50with AMF.UML.Named_Elements.Collections;
51with AMF.UML.Namespaces;
52with AMF.UML.Package_Imports.Collections;
53with AMF.UML.Packageable_Elements.Collections;
54with AMF.UML.Packages.Collections;
55with AMF.UML.Redefinable_Elements.Collections;
56with AMF.UML.Regions;
57with AMF.UML.State_Machines;
58with AMF.UML.States;
59with AMF.UML.String_Expressions;
60with AMF.UML.Transitions.Collections;
61with AMF.UML.Vertexs.Collections;
62with AMF.Visitors;
63
64package AMF.Internals.UML_Regions is
65
66   type UML_Region_Proxy is
67     limited new AMF.Internals.UML_Named_Elements.UML_Named_Element_Proxy
68       and AMF.UML.Regions.UML_Region with null record;
69
70   overriding function Get_Extended_Region
71    (Self : not null access constant UML_Region_Proxy)
72       return AMF.UML.Regions.UML_Region_Access;
73   --  Getter of Region::extendedRegion.
74   --
75   --  The region of which this region is an extension.
76
77   overriding procedure Set_Extended_Region
78    (Self : not null access UML_Region_Proxy;
79     To   : AMF.UML.Regions.UML_Region_Access);
80   --  Setter of Region::extendedRegion.
81   --
82   --  The region of which this region is an extension.
83
84   overriding function Get_Redefinition_Context
85    (Self : not null access constant UML_Region_Proxy)
86       return AMF.UML.Classifiers.UML_Classifier_Access;
87   --  Getter of Region::redefinitionContext.
88   --
89   --  References the classifier in which context this element may be
90   --  redefined.
91
92   overriding function Get_State
93    (Self : not null access constant UML_Region_Proxy)
94       return AMF.UML.States.UML_State_Access;
95   --  Getter of Region::state.
96   --
97   --  The State that owns the Region. If a Region is owned by a State, then
98   --  it cannot also be owned by a StateMachine.
99
100   overriding procedure Set_State
101    (Self : not null access UML_Region_Proxy;
102     To   : AMF.UML.States.UML_State_Access);
103   --  Setter of Region::state.
104   --
105   --  The State that owns the Region. If a Region is owned by a State, then
106   --  it cannot also be owned by a StateMachine.
107
108   overriding function Get_State_Machine
109    (Self : not null access constant UML_Region_Proxy)
110       return AMF.UML.State_Machines.UML_State_Machine_Access;
111   --  Getter of Region::stateMachine.
112   --
113   --  The StateMachine that owns the Region. If a Region is owned by a
114   --  StateMachine, then it cannot also be owned by a State.
115
116   overriding procedure Set_State_Machine
117    (Self : not null access UML_Region_Proxy;
118     To   : AMF.UML.State_Machines.UML_State_Machine_Access);
119   --  Setter of Region::stateMachine.
120   --
121   --  The StateMachine that owns the Region. If a Region is owned by a
122   --  StateMachine, then it cannot also be owned by a State.
123
124   overriding function Get_Subvertex
125    (Self : not null access constant UML_Region_Proxy)
126       return AMF.UML.Vertexs.Collections.Set_Of_UML_Vertex;
127   --  Getter of Region::subvertex.
128   --
129   --  The set of vertices that are owned by this region.
130
131   overriding function Get_Transition
132    (Self : not null access constant UML_Region_Proxy)
133       return AMF.UML.Transitions.Collections.Set_Of_UML_Transition;
134   --  Getter of Region::transition.
135   --
136   --  The set of transitions owned by the region.
137
138   overriding function Get_Element_Import
139    (Self : not null access constant UML_Region_Proxy)
140       return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import;
141   --  Getter of Namespace::elementImport.
142   --
143   --  References the ElementImports owned by the Namespace.
144
145   overriding function Get_Imported_Member
146    (Self : not null access constant UML_Region_Proxy)
147       return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
148   --  Getter of Namespace::importedMember.
149   --
150   --  References the PackageableElements that are members of this Namespace
151   --  as a result of either PackageImports or ElementImports.
152
153   overriding function Get_Member
154    (Self : not null access constant UML_Region_Proxy)
155       return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
156   --  Getter of Namespace::member.
157   --
158   --  A collection of NamedElements identifiable within the Namespace, either
159   --  by being owned or by being introduced by importing or inheritance.
160
161   overriding function Get_Owned_Member
162    (Self : not null access constant UML_Region_Proxy)
163       return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
164   --  Getter of Namespace::ownedMember.
165   --
166   --  A collection of NamedElements owned by the Namespace.
167
168   overriding function Get_Owned_Rule
169    (Self : not null access constant UML_Region_Proxy)
170       return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint;
171   --  Getter of Namespace::ownedRule.
172   --
173   --  Specifies a set of Constraints owned by this Namespace.
174
175   overriding function Get_Package_Import
176    (Self : not null access constant UML_Region_Proxy)
177       return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import;
178   --  Getter of Namespace::packageImport.
179   --
180   --  References the PackageImports owned by the Namespace.
181
182   overriding function Get_Client_Dependency
183    (Self : not null access constant UML_Region_Proxy)
184       return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency;
185   --  Getter of NamedElement::clientDependency.
186   --
187   --  Indicates the dependencies that reference the client.
188
189   overriding function Get_Name_Expression
190    (Self : not null access constant UML_Region_Proxy)
191       return AMF.UML.String_Expressions.UML_String_Expression_Access;
192   --  Getter of NamedElement::nameExpression.
193   --
194   --  The string expression used to define the name of this named element.
195
196   overriding procedure Set_Name_Expression
197    (Self : not null access UML_Region_Proxy;
198     To   : AMF.UML.String_Expressions.UML_String_Expression_Access);
199   --  Setter of NamedElement::nameExpression.
200   --
201   --  The string expression used to define the name of this named element.
202
203   overriding function Get_Namespace
204    (Self : not null access constant UML_Region_Proxy)
205       return AMF.UML.Namespaces.UML_Namespace_Access;
206   --  Getter of NamedElement::namespace.
207   --
208   --  Specifies the namespace that owns the NamedElement.
209
210   overriding function Get_Qualified_Name
211    (Self : not null access constant UML_Region_Proxy)
212       return AMF.Optional_String;
213   --  Getter of NamedElement::qualifiedName.
214   --
215   --  A name which allows the NamedElement to be identified within a
216   --  hierarchy of nested Namespaces. It is constructed from the names of the
217   --  containing namespaces starting at the root of the hierarchy and ending
218   --  with the name of the NamedElement itself.
219
220   overriding function Get_Is_Leaf
221    (Self : not null access constant UML_Region_Proxy)
222       return Boolean;
223   --  Getter of RedefinableElement::isLeaf.
224   --
225   --  Indicates whether it is possible to further redefine a
226   --  RedefinableElement. If the value is true, then it is not possible to
227   --  further redefine the RedefinableElement. Note that this property is
228   --  preserved through package merge operations; that is, the capability to
229   --  redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in
230   --  the resulting RedefinableElement of a package merge operation where a
231   --  RedefinableElement with isLeaf=false is merged with a matching
232   --  RedefinableElement with isLeaf=true: the resulting RedefinableElement
233   --  will have isLeaf=false. Default value is false.
234
235   overriding procedure Set_Is_Leaf
236    (Self : not null access UML_Region_Proxy;
237     To   : Boolean);
238   --  Setter of RedefinableElement::isLeaf.
239   --
240   --  Indicates whether it is possible to further redefine a
241   --  RedefinableElement. If the value is true, then it is not possible to
242   --  further redefine the RedefinableElement. Note that this property is
243   --  preserved through package merge operations; that is, the capability to
244   --  redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in
245   --  the resulting RedefinableElement of a package merge operation where a
246   --  RedefinableElement with isLeaf=false is merged with a matching
247   --  RedefinableElement with isLeaf=true: the resulting RedefinableElement
248   --  will have isLeaf=false. Default value is false.
249
250   overriding function Get_Redefined_Element
251    (Self : not null access constant UML_Region_Proxy)
252       return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element;
253   --  Getter of RedefinableElement::redefinedElement.
254   --
255   --  The redefinable element that is being redefined by this element.
256
257   overriding function Get_Redefinition_Context
258    (Self : not null access constant UML_Region_Proxy)
259       return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
260   --  Getter of RedefinableElement::redefinitionContext.
261   --
262   --  References the contexts that this element may be redefined from.
263
264   overriding function Belongs_To_PSM
265    (Self : not null access constant UML_Region_Proxy)
266       return Boolean;
267   --  Operation Region::belongsToPSM.
268   --
269   --  The operation belongsToPSM () checks if the region belongs to a
270   --  protocol state machine
271
272   overriding function Containing_State_Machine
273    (Self : not null access constant UML_Region_Proxy)
274       return AMF.UML.State_Machines.UML_State_Machine_Access;
275   --  Operation Region::containingStateMachine.
276   --
277   --  The operation containingStateMachine() returns the sate machine in
278   --  which this Region is defined
279
280   overriding function Is_Consistent_With
281    (Self : not null access constant UML_Region_Proxy;
282     Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
283       return Boolean;
284   --  Operation Region::isConsistentWith.
285   --
286   --  The query isConsistentWith() specifies that a redefining region is
287   --  consistent with a redefined region provided that the redefining region
288   --  is an extension of the redefined region, i.e. it adds vertices and
289   --  transitions and it redefines states and transitions of the redefined
290   --  region.
291
292   overriding function Is_Redefinition_Context_Valid
293    (Self : not null access constant UML_Region_Proxy;
294     Redefined : AMF.UML.Regions.UML_Region_Access)
295       return Boolean;
296   --  Operation Region::isRedefinitionContextValid.
297   --
298   --  The query isRedefinitionContextValid() specifies whether the
299   --  redefinition contexts of a region are properly related to the
300   --  redefinition contexts of the specified region to allow this element to
301   --  redefine the other. The containing statemachine/state of a redefining
302   --  region must redefine the containing statemachine/state of the redefined
303   --  region.
304
305   overriding function Redefinition_Context
306    (Self : not null access constant UML_Region_Proxy)
307       return AMF.UML.Classifiers.UML_Classifier_Access;
308   --  Operation Region::redefinitionContext.
309   --
310   --  The redefinition context of a region is the nearest containing
311   --  statemachine
312
313   overriding function Exclude_Collisions
314    (Self : not null access constant UML_Region_Proxy;
315     Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
316       return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
317   --  Operation Namespace::excludeCollisions.
318   --
319   --  The query excludeCollisions() excludes from a set of
320   --  PackageableElements any that would not be distinguishable from each
321   --  other in this namespace.
322
323   overriding function Get_Names_Of_Member
324    (Self : not null access constant UML_Region_Proxy;
325     Element : AMF.UML.Named_Elements.UML_Named_Element_Access)
326       return AMF.String_Collections.Set_Of_String;
327   --  Operation Namespace::getNamesOfMember.
328   --
329   --  The query getNamesOfMember() takes importing into account. It gives
330   --  back the set of names that an element would have in an importing
331   --  namespace, either because it is owned, or if not owned then imported
332   --  individually, or if not individually then from a package.
333   --  The query getNamesOfMember() gives a set of all of the names that a
334   --  member would have in a Namespace. In general a member can have multiple
335   --  names in a Namespace if it is imported more than once with different
336   --  aliases. The query takes account of importing. It gives back the set of
337   --  names that an element would have in an importing namespace, either
338   --  because it is owned, or if not owned then imported individually, or if
339   --  not individually then from a package.
340
341   overriding function Import_Members
342    (Self : not null access constant UML_Region_Proxy;
343     Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
344       return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
345   --  Operation Namespace::importMembers.
346   --
347   --  The query importMembers() defines which of a set of PackageableElements
348   --  are actually imported into the namespace. This excludes hidden ones,
349   --  i.e., those which have names that conflict with names of owned members,
350   --  and also excludes elements which would have the same name when imported.
351
352   overriding function Imported_Member
353    (Self : not null access constant UML_Region_Proxy)
354       return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
355   --  Operation Namespace::importedMember.
356   --
357   --  The importedMember property is derived from the ElementImports and the
358   --  PackageImports. References the PackageableElements that are members of
359   --  this Namespace as a result of either PackageImports or ElementImports.
360
361   overriding function Members_Are_Distinguishable
362    (Self : not null access constant UML_Region_Proxy)
363       return Boolean;
364   --  Operation Namespace::membersAreDistinguishable.
365   --
366   --  The Boolean query membersAreDistinguishable() determines whether all of
367   --  the namespace's members are distinguishable within it.
368
369   overriding function Owned_Member
370    (Self : not null access constant UML_Region_Proxy)
371       return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
372   --  Operation Namespace::ownedMember.
373   --
374   --  Missing derivation for Namespace::/ownedMember : NamedElement
375
376   overriding function All_Owning_Packages
377    (Self : not null access constant UML_Region_Proxy)
378       return AMF.UML.Packages.Collections.Set_Of_UML_Package;
379   --  Operation NamedElement::allOwningPackages.
380   --
381   --  The query allOwningPackages() returns all the directly or indirectly
382   --  owning packages.
383
384   overriding function Is_Distinguishable_From
385    (Self : not null access constant UML_Region_Proxy;
386     N : AMF.UML.Named_Elements.UML_Named_Element_Access;
387     Ns : AMF.UML.Namespaces.UML_Namespace_Access)
388       return Boolean;
389   --  Operation NamedElement::isDistinguishableFrom.
390   --
391   --  The query isDistinguishableFrom() determines whether two NamedElements
392   --  may logically co-exist within a Namespace. By default, two named
393   --  elements are distinguishable if (a) they have unrelated types or (b)
394   --  they have related types but different names.
395
396   overriding function Namespace
397    (Self : not null access constant UML_Region_Proxy)
398       return AMF.UML.Namespaces.UML_Namespace_Access;
399   --  Operation NamedElement::namespace.
400   --
401   --  Missing derivation for NamedElement::/namespace : Namespace
402
403   overriding function Is_Redefinition_Context_Valid
404    (Self : not null access constant UML_Region_Proxy;
405     Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
406       return Boolean;
407   --  Operation RedefinableElement::isRedefinitionContextValid.
408   --
409   --  The query isRedefinitionContextValid() specifies whether the
410   --  redefinition contexts of this RedefinableElement are properly related
411   --  to the redefinition contexts of the specified RedefinableElement to
412   --  allow this element to redefine the other. By default at least one of
413   --  the redefinition contexts of this element must be a specialization of
414   --  at least one of the redefinition contexts of the specified element.
415
416   overriding procedure Enter_Element
417    (Self    : not null access constant UML_Region_Proxy;
418     Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
419     Control : in out AMF.Visitors.Traverse_Control);
420   --  Dispatch call to corresponding subprogram of visitor interface.
421
422   overriding procedure Leave_Element
423    (Self    : not null access constant UML_Region_Proxy;
424     Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
425     Control : in out AMF.Visitors.Traverse_Control);
426   --  Dispatch call to corresponding subprogram of visitor interface.
427
428   overriding procedure Visit_Element
429    (Self     : not null access constant UML_Region_Proxy;
430     Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
431     Visitor  : in out AMF.Visitors.Abstract_Visitor'Class;
432     Control  : in out AMF.Visitors.Traverse_Control);
433   --  Dispatch call to corresponding subprogram of iterator interface.
434
435end AMF.Internals.UML_Regions;
436