blob: de2ce27458120f1abfeb7b60538f4a68b0714ee0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
from operationscore.Behavior import *
import util.ComponentRegistry as compReg
class RunFinite(Behavior):
"""RunFinite will just wire input to output, but only a finite number of
times as specified by the Iterations argument tag"""
def behaviorInit(self):
pass
def processResponse(self, inp, state):
if state:
iterations = state
else:
iterations = self['Iterations']
if iterations > 0:
out = inp
else:
out = []
iterations -= 1
return (out, iterations)
|