Beispiel #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);
 }
Beispiel #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;
 }
 public ConnectMessageHandler(BeliefRepository repo, AgentMessageHandler protocol)
 {
     this.repo     = repo;
     this.protocol = protocol;
 }
Beispiel #5
0
 public void addNewActor(int actorID, BeliefRepository repo)
 {
     protocol.addActor(actorID, repo);
 }
Beispiel #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);
 }
 public void addNewActor(int actorID, BeliefRepository repo)
 {
 }