mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 23:51:32 +00:00
Implement first version of LinearFSM
This commit is contained in:
parent
1922050e87
commit
29da0a7ca6
@ -3,3 +3,4 @@
|
|||||||
|
|
||||||
from .event_handler_base import TriggerlessEventHandler, TriggeredEventHandler
|
from .event_handler_base import TriggerlessEventHandler, TriggeredEventHandler
|
||||||
from .fsm_base import FSMBase
|
from .fsm_base import FSMBase
|
||||||
|
from .linear_fsm import LinearFSM
|
||||||
|
9
lib/tfw/linear_fsm.py
Normal file
9
lib/tfw/linear_fsm.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
from .fsm_base import FSMBase
|
||||||
|
|
||||||
|
|
||||||
|
class LinearFSM(FSMBase):
|
||||||
|
def __init__(self, number_of_steps):
|
||||||
|
self.states = list(map(str, range(number_of_steps)))
|
||||||
|
self.transitions = [{'trigger': 'step', 'source': index, 'dest': str(int(index)+1)}
|
||||||
|
for index in self.states[:-1]]
|
||||||
|
super(LinearFSM, self).__init__()
|
Loading…
Reference in New Issue
Block a user