public override void action()
        {
            ACLMessage message = procAgent.receive();

            if (message != null)
            {
                if (message.getSender().getName().Contains("DistributorAgent"))
                {
                    incoming.Add(message.getContent());
                    if (incoming.Count == 2)
                    {
                        if (incoming[0].StartsWith("FirstSubset") && incoming[1].StartsWith("SecondSubset"))
                        {
                            procAgent.ProcessRecvData(incoming[0], incoming[1]);
                        }
                        else if (incoming[0].StartsWith("SecondSubset") && incoming[1].StartsWith("FirstSubset"))
                        {
                            procAgent.ProcessRecvData(incoming[1], incoming[0]);
                        }
                    }
                    var result = message.getContent().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                }
                else if (message.getSender().getName().Contains("HelperAgent"))
                {
                    procAgent.helpersResults[message.getSender().getName()] = message.getContent();
                }
            }
            else
            {
                block();
            }
        }
Beispiel #2
0
        public override void action()
        {
            ACLMessage message = helperAgent.receive();

            if (message != null)
            {
                incoming.Add(message.getSender());
                helperAgent.ProcessData(message.getContent(), message.getSender());
            }
            else
            {
                block();
            }
        }
        public override void action()
        {
            ACLMessage message = dispAgent.receive();

            if (message != null && !incoming.Contains(message.getSender()))
            {
                incoming.Add(message.getSender());
                dispAgent.ProcessData(message.getContent(), message.getSender());
            }
            else
            {
                block();
            }
        }
Beispiel #4
0
        public override void action()
        {
            ACLMessage message = distrAgent.receive();

            if (message != null)
            {
                if (message.getSender().getName().Contains("ProcessorAgent"))
                {
                    distrAgent.processorsResults[message.getSender().getName()] = message.getContent();
                    distrAgent.JoinFinalResults();
                }
            }
            else
            {
                block();
            }
        }
Beispiel #5
0
        public override void action()
        {
            MessageTemplate messageTemplate = MessageTemplate.MatchPerformative(ACLMessage.INFORM);
            ACLMessage      aCLMessage      = myAgent.receive(messageTemplate);

            if (aCLMessage == null)
            {
                block(500);
            }
            else
            {
                Console.WriteLine("New message received from " + aCLMessage.getSender().getName());
                Console.WriteLine("Message content: " + aCLMessage.getContent());
            }
        }