Пример #1
0
 def add_network_actor(self, ref, actor_id):
     # Type not currently put into actor_id
     self.actor_store[actor_id] = ref
     id_num = ids.num(actor_id)
     self.shared_data.id_at_port(id_num)
     type = ids.type(actor_id)
     self.types[type].add(actor_id)
Пример #2
0
 def says(self):
   print("")
   while not self.queue.empty():
     (id, msg) = self.queue.get()
     print(ids.type(id) + " (from" + ids.port(id) + ") says: " + msg)
     if self.queue.empty():
       timing.sleep(1)
     print(self.loc + '>')
Пример #3
0
 def remove(self, actor_id):
     # exception for not exists
     if actor_id in self.actor_store:
         del self.actor_store[actor_id]
         type = ids.type(actor_id)
         if len(self.types[type]) == 1:
             del self.types[type]
         else:
             self.types[type] = self.types[type].discard(loc)
Пример #4
0
 def add_actor(self, id):
   to_store = ids.type(id) + '-' + str(ids.num(id))
   self.actors[to_store] = VisActor(to_store)
Пример #5
0
 def store_type(self, actor):
   ref = VisActorRef(ids.type(actor), ids.loc(actor))
   self.type_store.append(ref)