def goto(self, rTarget, **kwargs):
if callable(rTarget) is False:
rTarget = self.registry[rTarget]
if( "payload" in kwargs ):
self.tEvt['payload'] = kwargs['payload']
"""Transition to a new state (Cached Version)"""
caller = inspect.stack()[1][3] # hsm could be calling its super states
# we aren't tracking this in this, so we can
# just reference the call stack to find who
# discovered the event
#print "\nCurrent state: ", self.rCurr; print "Source state: ", self.rSource
self.__spy__(caller, self.tEvt['event'], self.tEvt['payload'])
# this is how you see the target
if self.rCurr['toLcaCache'].get(self.tEvt['event'], None) == None:
self.rCurr['toLcaCache'][self.tEvt['event']] = \
self.to_lca(self.hsm_dict[rTarget])
# self.pp.pprint(self.rCurr); print
self.exit(self.rCurr['toLcaCache'][self.tEvt['event']])
self.rNext = self.hsm_dict[rTarget]
评论列表
文章目录