mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-12-23 03:11:55 +00:00
Merge pull request #28 from avatao-content/linearfsm
Implement first version of LinearFSM
This commit is contained in:
commit
ba66188d80
@ -3,3 +3,4 @@
|
||||
|
||||
from .event_handler_base import TriggerlessEventHandler, TriggeredEventHandler
|
||||
from .fsm_base import FSMBase
|
||||
from .linear_fsm import LinearFSM
|
||||
|
12
lib/tfw/linear_fsm.py
Normal file
12
lib/tfw/linear_fsm.py
Normal file
@ -0,0 +1,12 @@
|
||||
# Copyright (C) 2018 Avatao.com Innovative Learning Kft.
|
||||
# All Rights Reserved. See LICENSE file for details.
|
||||
|
||||
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