Ejemplo n.º 1
0
 protected internal override void ReciveMessage(Message message)
 {
     if (message == null) {
         return;
     }
     Queue<Message> msgs;
     if (!this.mailbox.TryGetValue (message.Sender, out  msgs)) {
         msgs = new Queue<Message> ();
         this.mailbox.Add (message.Sender, msgs);
     }
     msgs.Enqueue (message);
 }
Ejemplo n.º 2
0
 protected internal override void ReciveMessage(Message message)
 {
 }
Ejemplo n.º 3
0
 protected void SendMessage(Message message)
 {
     if(message.Sender != this) {
         throw new ArgumentException("An algorithm can only send message with itself as sender.");
     }
     ParallelAlgorithm receiver = message.Receiver;
     Edge e;
     if(receiver == this) {
         this.ReciveMessage(message);
     }
     else if(this.edges.TryGetValue(receiver, out e)) {
         e.RouteMessage(message);
     }
     else {
         throw new ArgumentException("Can't route message: the node is  not connected to the receiving node.");
     }
 }
Ejemplo n.º 4
0
 public void RouteMessage(Message message)
 {
     if(message.Sender == Node1 && message.Receiver == Node2) {
         this.atob.Enqueue(new PostedMessage(this.Simulator.Time, message));
     }
     else
     if(message.Sender == Node2 && message.Receiver == Node1) {
         this.btoa.Enqueue(new PostedMessage(this.Simulator.Time, message));
     }
 }
Ejemplo n.º 5
0
 protected internal abstract void ReciveMessage(Message message);