Skip to content

FLGo

VirtualCommunicator

Communicator that simulates the communication phase between any two objects

Source code in flgo\__init__.py
 6
 7
 8
 9
10
11
12
13
14
15
16
class VirtualCommunicator:
    """
    Communicator that simulates the communication phase between any two objects
    """
    def __init__(self, objects):
        self.objects_map = {obj.id:obj for obj in objects}
        self.objects = objects

    def request(self, source, target, package):
        # send package to the target object with `package` and `mtype`, and then listen from it
        return self.objects_map[target].message_handler(package)