-
Notifications
You must be signed in to change notification settings - Fork 0
/
run2.py
29 lines (24 loc) · 875 Bytes
/
run2.py
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
26
27
28
29
from typing import Type
from pprint import pprint
from examples.helloworld import HelloWorld2
from src.fsm import FsmMarkup
class HelloworldFsmMarkup(FsmMarkup):
def __init__(self):
super().__init__()
self.model = HelloWorld2
self.add_event(self.model.turn_switch, None, None)
self.add_event(self.model.increase_value, [(1,), (2,), (3,)])
self.state_values['Switch'] = lambda model_obj: model_obj.switch
self.state_values['Value'] = lambda model_obj: model_obj.value
fsm = HelloworldFsmMarkup()
print("Random path:")
path = fsm.get_random_path(16)
pprint(path)
obj = HelloWorld2()
walk_result = fsm.walk(obj, path)
uml_text = fsm.dump_plantuml(walk_result)
with open("result.uml", 'w') as uml_file:
uml_file.writelines(uml_text)
print("I'm going to go elsewhere.")
for i in range(10):
print("Go away forever!")