-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomponent_manager.py
42 lines (32 loc) · 1.03 KB
/
component_manager.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
30
31
32
33
34
35
36
37
38
39
40
41
42
from typing import Callable, List
from structs import Behavior, BehaviorMessage, Chart, Message
from translator import Translator
class ComponentManager:
def __init__(
self,
id: int,
send: Callable[[Message], None],
behavior: Behavior,
translator: Translator,
) -> None:
self.id = id
self.send = send
self.behavior = behavior
self.translator = translator
def send_list(self, messages: List[BehaviorMessage], lvt: int):
for m in messages:
self.send(self.translator.translate(message=m, lvt=lvt))
def can_run_without_new_messages(self) -> bool:
return True
def init(self) -> None:
raise NotImplementedError
def on_message(self, message: Message) -> None:
raise NotImplementedError
def step(self) -> None:
raise NotImplementedError
def refuses_to_continue(self) -> bool:
return False
def on_exit(self) -> None:
pass
def get_charts(self) -> List[Chart]:
return []