Exemple #1
0
 public void sendMessage(Message message) {
   sentMessages.add(message);
   logger.info("Sending message " + message.getContent());
   String receiver = message.getTo();
   Agent agentTo = agents.get(receiver);
   if (agentTo != null) {
     agentTo.receive(message);
   } else {
     logger.info(
         "Could not deliver message <" + message.getContent() + " to unknown agent " + receiver);
   }
 }
Exemple #2
0
 public void disconnectAgent(Agent agent) {
   logger.info("Disconnecting " + agent.agentName());
   agents.remove(agent);
 }
Exemple #3
0
 public void connectAgent(String name, Agent agent) {
   logger.info("Connecting " + agent.agentName());
   agents.put(name, agent);
 }