예제 #1
0
        private AgentMessageHandler findHandler(int actorID)
        {
            AgentMessageHandler handler = null;

            handlers.TryGetValue(actorID, out handler);
            return(handler);
        }
예제 #2
0
        public void synchronizeBelief(Belief belief, int sourceID)
        {
            AgentMessageHandler handler = findHandler(sourceID);

            if (handler != null)
            {
                handler.synchronizeBelief(belief);
            }
        }
예제 #3
0
        public void synchronizeAllBeliefsFor(int actorID)
        {
            AgentMessageHandler handler = findHandler(actorID);

            if (handler != null)
            {
                handler.synchronizeAllBeliefs();
            }
        }
예제 #4
0
        public void handleMessage(Message message)
        {
            BSPMessage          bspMessage = parse(message);
            AgentMessageHandler handler    = null;

            if (handlers.TryGetValue(bspMessage.getSourceID(), out handler))
            {
                handler.handleMessage(bspMessage);
            }
        }
예제 #5
0
        public string getConnectionString(int actorID)
        {
            AgentMessageHandler handler = findHandler(actorID);

            if (handler != null)
            {
                IPEndPoint address = handler.getConnection().getRemoteAddress();
                if (address != null)
                {
                    return(address.ToString());
                }
            }
            return("Not Connected");
        }
 public PostMessageHandler(BeliefRepository repo, AgentMessageHandler protocol, Serializer serializer)
 {
     this.repo       = repo;
     this.protocol   = protocol;
     this.serializer = serializer;
 }
예제 #7
0
 public ConnectMessageHandler(BeliefRepository repo, AgentMessageHandler protocol)
 {
     this.repo     = repo;
     this.protocol = protocol;
 }
예제 #8
0
        public void addActor(int actorID, BeliefRepository repo)
        {
            INetworkConnection connection = new AgentConnection(this, actorID);

            handlers[actorID] = new AgentMessageHandler(actorID, repo, connection, serializer);
        }
 public SyncMessageHandler(BeliefRepository repo, AgentMessageHandler protocol)
 {
     this.repo     = repo;
     this.protocol = protocol;
     remoteState   = new RepositoryState(-1);
 }