3e11f2587af0970fe57126515b627bae49d5dbb1
2 Created on 21 aout 2009
4 @author: Samuel Benveniste
13 def __init__(self
,eventGroups
= [], times
= []):
17 self
.eventGroups
= eventGroups
20 self
.yielder
= self
.eventGroupYielder()
25 def __getstate__(self
):
27 d
.append(self
.eventGroups
)
31 def __setstate__(self
,d
):
32 self
.eventGroups
= d
[0]
34 self
.yielder
= self
.eventGroupYielder()
38 def appendEventGroup(self
, eventGroup
):
41 self
.eventGroups
.append(eventGroup
)
43 def update(self
,timePassed
):
44 self
._timeCounter
+= timePassed
46 def setReplayRate(self
,rate
):
48 self
.yielder
= self
.eventGroupYielder()
50 def getPickledEvents(self
):
51 return(self
.yielder
.next())
53 def getCurrentTime(self
):
54 return(self
.times
[self
.yieldPointer
])
56 def eventGroupYielder(self
):
58 Will return the next event to post if enough time has passed and [] otherwise
61 while i
in range(len(self
.eventGroups
)):
62 print "rate is " + str(self
.rate
)
63 if self
._timeCounter
*self
.rate
>self
.times
[i
]:
64 print str(self
._timeCounter
*self
.rate
)+" > "+ str(self
.times
[i
])
66 yield self
.eventGroups
[i
]