def timeout(self):
return UpdateStateMachine.INFINITE_PERIOD
+ def __repr__(self):
+ return "NopStateStrategy()"
+
class ConstantStateStrategy(object):
def timeout(self):
return self._timeout
+ def __repr__(self):
+ return "ConstantStateStrategy(timeout=%r)" % self._timeout
+
class GeometricStateStrategy(object):
timeout = self._init + self._current
return timeout
+ def __repr__(self):
+ return "GeometricStateStrategy(init=%r, min=%r, max=%r)" % (
+ self._init, self._min, self._max
+ )
+
class StateMachine(object):
)
)
+ def __repr__(self):
+ return """UpdateStateMachine(
+ name=%r,
+ strategie=%r,
+)""" % (self._name, self._strategies)
+
def set_state_strategy(self, state, strategy):
self._strategies[state] = strategy