예제 #1
0
 public AgentMessageHandler(int agentID, BeliefRepository repo, INetworkConnection connection, Serializer serializer)
 {
     this.agentID        = agentID;
     this.connection     = connection;
     this.connectHandler = new ConnectMessageHandler(repo, this);
     this.postHandler    = new PostMessageHandler(repo, this, serializer);
     this.syncHandler    = new SyncMessageHandler(repo, this);
 }
예제 #2
0
        public void SyncWith(BeliefRepository other)
        {
            foreach (CachedBelief belief in Diff(other.CurrentState()))
            {
                other.Commit(belief.GetBelief());
            }

            foreach (CachedBelief belief in other.Diff(CurrentState()))
            {
                other.Commit(belief.GetBelief());
            }
        }
 public PostMessageHandler(BeliefRepository repo, AgentMessageHandler protocol, Serializer serializer)
 {
     this.repo       = repo;
     this.protocol   = protocol;
     this.serializer = serializer;
 }
예제 #4
0
 public ConnectMessageHandler(BeliefRepository repo, AgentMessageHandler protocol)
 {
     this.repo     = repo;
     this.protocol = protocol;
 }
예제 #5
0
 public void addNewActor(int actorID, BeliefRepository repo)
 {
     protocol.addActor(actorID, repo);
 }
예제 #6
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);
 }
예제 #8
0
 public void addNewActor(int actorID, BeliefRepository repo)
 {
 }