Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 55 additions & 30 deletions bridgepoint/prebuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -1514,7 +1514,7 @@ def accept_BodyNode(self, node):
act_brb = self.new('ACT_BRB')
relate(act_brb, self._s_brg, 697)

self.act_act = self.new('ACT_ACT', Type='bridge')
self.act_act = self.new('ACT_ACT', Type='bridge', Label=self.label)
relate(act_brb, self.act_act, 698)

return ActionPrebuilder.accept_BodyNode(self, node)
Expand Down Expand Up @@ -1620,21 +1620,23 @@ class TransitionPrebuilder(ActionPrebuilder):
def __init__(self, metamodel, sm_act):
self._sm_act = sm_act
self._sm_evt = (one(sm_act).SM_AH[514].SM_TAH[513].SM_TXN[530].
SM_NSTXN[507].SM_SEME[504].SM_SEVT[503].SM_EVT[525]())
SM_NSTXN[507].SM_SEME[504].SM_SEVT[503].SM_EVT[525]() or
one(sm_act).SM_AH[514].SM_TAH[513].SM_TXN[530].
SM_CRTXN[507].SM_LEVT[509].SM_SEVT[526].SM_EVT[525]())
self._sm_state = one(sm_act).SM_AH[514].SM_MOAH[513].SM_STATE[511]()
self._o_obj = (one(sm_act).SM_SM[515].SM_ISM[517].O_OBJ[518]() or
one(sm_act).SM_SM[515].SM_ASM[517].O_OBJ[519]())

if self._sm_evt:
self.element_type = 'Transition'
action_name = self.get_event_name(self._sm_evt)

elif self._sm_state:
if self._sm_state:
self.element_type = 'State'
action_name = self._sm_state.Name

else:
self.element_type = 'Transition'
action_name = self.get_txn_name()

self.label = '::'.join([get_parent_label(self._o_obj), self._o_obj.Name,
action_name])
self.get_sm_type(), action_name])

c_c = get_defining_component(self._o_obj)
ActionPrebuilder.__init__(self, metamodel, c_c)
Expand All @@ -1647,41 +1649,64 @@ def find_symbol(self, node, name):

return v_var

def get_event_name(self, event):
sm_nlevt = one(event).SM_SEVT[525].SM_NLEVT[526]()
sm_sgevt = one(event).SM_SEVT[525].SM_SGEVT[526]()
sm_pevt = one(sm_nlevt).SM_PEVT[527]()

# If polymorphic and the polymorphic event is not local,
# use the poly local class name
if sm_pevt and sm_pevt.SM_ID != sm_nlevt.SM_ID:
return event.Mning + "::" + sm_pevt.localClassName

# If an orphaned polymorphic, append that to the name
if sm_nlevt is not None and sm_pevt is None:
return event.Mning + "::Orphaned"
def get_event_name(self):
if self._sm_evt:
sm_nlevt = one(self._sm_evt).SM_SEVT[525].SM_NLEVT[526]()
sm_sgevt = one(self._sm_evt).SM_SEVT[525].SM_SGEVT[526]()
sm_pevt = one(sm_nlevt).SM_PEVT[527]()

# If polymorphic and the polymorphic event is not local,
# use the poly local class name
if sm_pevt and sm_pevt.SM_ID != sm_nlevt.SM_ID:
return sm_pevt.localClassName + '::' + self._sm_evt.Mning

# If an orphaned polymorphic, append that to the name
if sm_nlevt is not None and sm_pevt is None:
return 'Orphaned::' + self._sm_evt.Mning

# If a signal event we use only the derived label
if sm_sgevt is not None:
return event.Drv_Lbl
# If a signal event we use only the derived label
if sm_sgevt is not None:
return self._sm_evt.Drv_Lbl

# otherwise we combine the label with the event Mning
return event.Drv_Lbl + ": " + event.Mning
# otherwise we combine the label with the event Mning
return self._sm_evt.Drv_Lbl + ": " + self._sm_evt.Mning
else:
return 'No Event'

def get_sm_type(self):
sm_ism = one(self._sm_act).SM_SM[515].SM_ISM[517]()
return 'InstanceStateMachine' if sm_ism else 'ClassStateMachine'

def get_txn_name(self):
dest_state = (one(self._sm_act).SM_AH[514].SM_TAH[513].SM_TXN[530].
SM_STATE[506]())
if dest_state:
start_state = (one(self._sm_act).SM_AH[514].SM_TAH[513].SM_TXN[530].
SM_NSTXN[507].SM_SEME[504].SM_STATE[503]() or
one(self._sm_act).SM_AH[514].SM_TAH[513].SM_TXN[530].
SM_NETXN[507].SM_STATE[508]())
if start_state:
return (start_state.Name + ' [' + self.get_event_name() + '] => ' +
dest_state.Name)
else:
# for creation states, use the imaginary "Non Existent" state
return ('Non Existent [' + self.get_event_name() + '] => ' +
dest_state.Name)

def accept_BodyNode(self, node):
sm_moah = one(self._sm_act).SM_AH[514].SM_MOAH[513]()
if sm_moah is not None:
act_sab = self.new('ACT_SAB')
relate(act_sab, self._sm_act, 691)

self.act_act = self.new('ACT_ACT')
self.act_act = self.new('ACT_ACT', Type='state', Label=self.label)

relate(act_sab, self.act_act, 698)
else:
act_tab = self.new('ACT_TAB')
relate(act_tab, self._sm_act, 688)

self.act_act = self.new('ACT_ACT')
self.act_act = self.new('ACT_ACT', Type='transition', Label=self.label)

relate(act_tab, self.act_act, 698)

Expand Down Expand Up @@ -1804,7 +1829,7 @@ def accept_BodyNode(self, node):
act_rsb = self.new('ACT_RSB')
relate(act_rsb, self._spr_rs, 684)

self.act_act = self.new('ACT_ACT', Type='interface signal')
self.act_act = self.new('ACT_ACT', Type='interface signal', Label=self.label)
relate(act_rsb, self.act_act, 698)

return ActionPrebuilder.accept_BodyNode(self, node)
Expand Down Expand Up @@ -1874,7 +1899,7 @@ def accept_BodyNode(self, node):
act_psb = self.new('ACT_PSB')
relate(act_psb, self._spr_ps, 686)

self.act_act = self.new('ACT_ACT', Type='interface signal')
self.act_act = self.new('ACT_ACT', Type='interface signal', Label=self.label)
relate(act_psb, self.act_act, 698)

return ActionPrebuilder.accept_BodyNode(self, node)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def run(self):
long_description = f.read()

setup(name='pyxtuml',
version='2.3.0', # ensure that this is the same as in xtuml.version
version='2.3.1a1', # ensure that this is the same as in xtuml.version
description='Library for parsing, manipulating, and generating BridgePoint xtUML models',
long_description=long_description,
long_description_content_type='text/x-rst',
Expand Down
2 changes: 1 addition & 1 deletion xtuml/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
name = 'pyxtuml'
date = '2021-11-06'
version = '2.3'
release = '2.3.0' # ensure that this is the same as in setup.py
release = '2.3.1a1' # ensure that this is the same as in setup.py

complete_string = '%s v%s (%s)' % (name, release, date)