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