minor API refinements

This commit is contained in:
David Rose 2006-01-19 16:23:24 +00:00
parent 293b6cd493
commit e3e37d3bba

View File

@ -125,14 +125,6 @@ class FSM(DirectObject.DirectObject):
SerialNum = 0 SerialNum = 0
def __init__(self, name):
self.name = name
self._serialNum = FSM.SerialNum
FSM.SerialNum += 1
self._broadcastStateChanges = False
# Initially, we are in the Off state by convention.
self.state = 'Off'
# This member lists the default transitions that are accepted # This member lists the default transitions that are accepted
# without question by the defaultFilter. It's a map of state # without question by the defaultFilter. It's a map of state
# names to a list of legal target state names from that state. # names to a list of legal target state names from that state.
@ -143,7 +135,15 @@ class FSM(DirectObject.DirectObject):
# a capital letter) are allowed. If it is set to an empty # a capital letter) are allowed. If it is set to an empty
# map, no transitions are implicitly allowed--all transitions # map, no transitions are implicitly allowed--all transitions
# must be approved by some filter function. # must be approved by some filter function.
self.defaultTransitions = None defaultTransitions = None
def __init__(self, name):
self.name = name
self._serialNum = FSM.SerialNum
FSM.SerialNum += 1
self._broadcastStateChanges = False
# Initially, we are in the Off state by convention.
self.state = 'Off'
# This member records transition requests made by demand() or # This member records transition requests made by demand() or
# forceTransition() while the FSM is in transition between # forceTransition() while the FSM is in transition between
@ -259,7 +259,7 @@ class FSM(DirectObject.DirectObject):
if isinstance(result, types.StringTypes): if isinstance(result, types.StringTypes):
# If the return value is a string, it's just the name # If the return value is a string, it's just the name
# of the state. Wrap it in a tuple for consistency. # of the state. Wrap it in a tuple for consistency.
result = (result,) result = (result,) + args
# Otherwise, assume it's a (name, *args) tuple # Otherwise, assume it's a (name, *args) tuple
self.__setState(*result) self.__setState(*result)