Changeset 78
- Timestamp:
- 04/02/02 15:14:56 (7 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBJabber/RBJabber/SubjectObserver/StateMachine.py
r77 r78 46 46 _handled = 0 47 47 48 def __init__(self, Description="", ReduceFn=and_): 48 def __init__(self, ReduceFn=and_, **kw): 49 self.__dict__.update(kw) 49 50 super(State, self).__init__() 50 self.Description = Description51 51 self._Influxs = [] 52 52 self._StateSubject = Subject() … … 73 73 74 74 def SetHandled(self): 75 self._handled = 175 self._handled += 1 76 76 77 77 def CheckInfluxs(self, subject, **kw): … … 96 96 def _Test_StateMachine(): 97 97 def PrintDescription(StateSubject, precondition): 98 print StateSubject. Description, precondition98 print StateSubject.__doc__ 99 99 StateSubject.SetState() 100 100 101 a = State( "Initial").AddObserver(PrintDescription)102 b = State( "MiddleB").AddObserver(PrintDescription)103 c = State( "MiddleC").AddObserver(PrintDescription)104 d = State( "Final").AddObserver(PrintDescription)101 a = State(__doc__="A").AddObserver(PrintDescription) 102 b = State(__doc__="B").AddObserver(PrintDescription) 103 c = State(__doc__="C").AddObserver(PrintDescription) 104 d = State(__doc__="D").AddObserver(PrintDescription) 105 105 106 106 b.AddInflux(a)
