1- __all__ = ["BEHAVIOUR" , "EXECUTION" , "OPERATION" , "INTERFACE" , "COMPARISONS" ]
2-
31import logging
4- automata_bpp_logger = logging .getLogger (__name__ )
2+ from functools import wraps
3+
4+ LOGGER = logging .getLogger (__name__ )
5+
6+ from .commandqueue .commandqueue import CommandQueue
7+ from .comparisons .comparisons import COMPARISONS
8+ from .constants import START_COMMAND , STOP_COMMAND , GRAPHS_DIRECTORY
9+ from .machines .machines import Machines
10+ from .xml .xmlread import read_graphml
11+
12+ __all__ = ["BEHAVIOUR" , "EXECUTION" , "OPERATION" , "INTERFACE" , "COMPARISONS" , "LOGGER" ]
513
6- from . machines .machines import Machines
7- from . xml .xmlread import read_graphml
8- from . commandqueue .commandqueue import CommandQueue
9- from . constants import GRAPHS_DIRECTORY , START_COMMAND_NAME , STOP_COMMAND_NAME
10- from . comparisons .comparisons import COMPARISONS
1114
12- from functools import wraps
1315
1416
1517class BEHAVIOUR :
@@ -24,42 +26,42 @@ def load_behaviour_from_graph(graph_file_path: str, machine_name: str):
2426 if graph_file_path [- 8 :] == ".graphml" :
2527 read_graphml ("{}/{}" .format (GRAPHS_DIRECTORY , graph_file_path ), machine_name )
2628 else :
27- automata_bpp_logger .warning ("Unknown format for reading the graph file: {}" .format (graph_file_path ))
29+ LOGGER .warning ("Unknown format for reading the graph file: {}" .format (graph_file_path ))
2830
2931
3032class EXECUTION :
3133
3234 @staticmethod
3335 def state (func ):
34- current_machine = Machines ().GetCurrentDefinedMachine ()
35- if current_machine is not None :
36- current_machine . SetExecuteStateFunction (func .__name__ , func )
36+ machine = Machines ().this_machine ()
37+ if machine is not None :
38+ machine . set_state_function (func .__name__ , func )
3739 return func
3840
3941
4042class OPERATION :
4143
4244 @staticmethod
43- def start_fsm ():
44- Machines ().ExecuteCommand ( START_COMMAND_NAME )
45+ def start ():
46+ Machines ().execute_command ( START_COMMAND )
4547
4648 @staticmethod
47- def stop_fsm ():
48- Machines ().ExecuteCommand ( STOP_COMMAND_NAME )
49- Machines ().ReturnToStart ()
50- CommandQueue ().EmptyAllCommands ()
49+ def stop ():
50+ Machines ().execute_command ( STOP_COMMAND )
51+ Machines ().reset_machines ()
52+ CommandQueue ().clear_all ()
5153
5254 @staticmethod
53- def reset_fsm ():
54- OPERATION .stop_fsm ()
55- OPERATION .start_fsm ()
55+ def reset ():
56+ OPERATION .stop ()
57+ OPERATION .start ()
5658
5759 @staticmethod
58- def run_fsm (cmd = None ):
60+ def run (cmd = None ):
5961 if cmd is None :
60- Machines ().ExecuteAllCommands ()
62+ Machines ().execute_all ()
6163 else :
62- Machines ().ExecuteCommand (cmd )
64+ Machines ().execute_command (cmd )
6365
6466
6567class INTERFACE :
@@ -71,7 +73,9 @@ def wrapper_out(func):
7173 def wrapper_in (* args , ** kwargs ):
7274 result = func (* args , ** kwargs )
7375 if lambda_func (result ):
74- Machines ().ExecuteCommand (command )
76+ Machines ().execute_command (command )
7577 return result
78+
7679 return wrapper_in
80+
7781 return wrapper_out
0 commit comments