@@ -1620,21 +1620,23 @@ class TransitionPrebuilder(ActionPrebuilder):
1620
1620
def __init__ (self , metamodel , sm_act ):
1621
1621
self ._sm_act = sm_act
1622
1622
self ._sm_evt = (one (sm_act ).SM_AH [514 ].SM_TAH [513 ].SM_TXN [530 ].
1623
- SM_NSTXN [507 ].SM_SEME [504 ].SM_SEVT [503 ].SM_EVT [525 ]())
1623
+ SM_NSTXN [507 ].SM_SEME [504 ].SM_SEVT [503 ].SM_EVT [525 ]() or
1624
+ one (sm_act ).SM_AH [514 ].SM_TAH [513 ].SM_TXN [530 ].
1625
+ SM_CRTXN [507 ].SM_LEVT [509 ].SM_SEVT [526 ].SM_EVT [525 ]())
1624
1626
self ._sm_state = one (sm_act ).SM_AH [514 ].SM_MOAH [513 ].SM_STATE [511 ]()
1625
1627
self ._o_obj = (one (sm_act ).SM_SM [515 ].SM_ISM [517 ].O_OBJ [518 ]() or
1626
1628
one (sm_act ).SM_SM [515 ].SM_ASM [517 ].O_OBJ [519 ]())
1627
-
1628
- if self ._sm_evt :
1629
- self .element_type = 'Transition'
1630
- action_name = self .get_event_name (self ._sm_evt )
1631
1629
1632
- elif self ._sm_state :
1630
+ if self ._sm_state :
1633
1631
self .element_type = 'State'
1634
1632
action_name = self ._sm_state .Name
1633
+
1634
+ else :
1635
+ self .element_type = 'Transition'
1636
+ action_name = self .get_txn_name ()
1635
1637
1636
1638
self .label = '::' .join ([get_parent_label (self ._o_obj ), self ._o_obj .Name ,
1637
- action_name ])
1639
+ self . get_sm_type (), action_name ])
1638
1640
1639
1641
c_c = get_defining_component (self ._o_obj )
1640
1642
ActionPrebuilder .__init__ (self , metamodel , c_c )
@@ -1647,26 +1649,49 @@ def find_symbol(self, node, name):
1647
1649
1648
1650
return v_var
1649
1651
1650
- def get_event_name (self , event ):
1651
- sm_nlevt = one (event ).SM_SEVT [525 ].SM_NLEVT [526 ]()
1652
- sm_sgevt = one (event ).SM_SEVT [525 ].SM_SGEVT [526 ]()
1653
- sm_pevt = one (sm_nlevt ).SM_PEVT [527 ]()
1654
-
1655
- # If polymorphic and the polymorphic event is not local,
1656
- # use the poly local class name
1657
- if sm_pevt and sm_pevt .SM_ID != sm_nlevt .SM_ID :
1658
- return event .Mning + "::" + sm_pevt .localClassName
1659
-
1660
- # If an orphaned polymorphic, append that to the name
1661
- if sm_nlevt is not None and sm_pevt is None :
1662
- return event .Mning + "::Orphaned"
1652
+ def get_event_name (self ):
1653
+ if self ._sm_evt :
1654
+ sm_nlevt = one (self ._sm_evt ).SM_SEVT [525 ].SM_NLEVT [526 ]()
1655
+ sm_sgevt = one (self ._sm_evt ).SM_SEVT [525 ].SM_SGEVT [526 ]()
1656
+ sm_pevt = one (sm_nlevt ).SM_PEVT [527 ]()
1657
+
1658
+ # If polymorphic and the polymorphic event is not local,
1659
+ # use the poly local class name
1660
+ if sm_pevt and sm_pevt .SM_ID != sm_nlevt .SM_ID :
1661
+ return sm_pevt .localClassName + '::' + self ._sm_evt .Mning
1662
+
1663
+ # If an orphaned polymorphic, append that to the name
1664
+ if sm_nlevt is not None and sm_pevt is None :
1665
+ return 'Orphaned::' + self ._sm_evt .Mning
1663
1666
1664
- # If a signal event we use only the derived label
1665
- if sm_sgevt is not None :
1666
- return event .Drv_Lbl
1667
+ # If a signal event we use only the derived label
1668
+ if sm_sgevt is not None :
1669
+ return self . _sm_evt .Drv_Lbl
1667
1670
1668
- # otherwise we combine the label with the event Mning
1669
- return event .Drv_Lbl + ": " + event .Mning
1671
+ # otherwise we combine the label with the event Mning
1672
+ return self ._sm_evt .Drv_Lbl + ": " + self ._sm_evt .Mning
1673
+ else :
1674
+ return 'No Event'
1675
+
1676
+ def get_sm_type (self ):
1677
+ sm_ism = one (self ._sm_act ).SM_SM [515 ].SM_ISM [517 ]()
1678
+ return 'InstanceStateMachine' if sm_ism else 'ClassStateMachine'
1679
+
1680
+ def get_txn_name (self ):
1681
+ dest_state = (one (self ._sm_act ).SM_AH [514 ].SM_TAH [513 ].SM_TXN [530 ].
1682
+ SM_STATE [506 ]())
1683
+ if dest_state :
1684
+ start_state = (one (self ._sm_act ).SM_AH [514 ].SM_TAH [513 ].SM_TXN [530 ].
1685
+ SM_NSTXN [507 ].SM_SEME [504 ].SM_STATE [503 ]() or
1686
+ one (self ._sm_act ).SM_AH [514 ].SM_TAH [513 ].SM_TXN [530 ].
1687
+ SM_NETXN [507 ].SM_STATE [508 ]())
1688
+ if start_state :
1689
+ return (start_state .Name + ' [' + self .get_event_name () + '] => ' +
1690
+ dest_state .Name )
1691
+ else :
1692
+ # for creation states, use the imaginary "Non Existent" state
1693
+ return ('Non Existent [' + self .get_event_name () + '] => ' +
1694
+ dest_state .Name )
1670
1695
1671
1696
def accept_BodyNode (self , node ):
1672
1697
sm_moah = one (self ._sm_act ).SM_AH [514 ].SM_MOAH [513 ]()
0 commit comments