Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Profile p     = new ProfileImpl();
            String  index = String.Empty;
            Runtime rt    = Runtime.instance();

            jade.wrapper.AgentContainer distrCont  = JadeHelper.CreateContainer("DistributorContainer", true, "localhost", "", "1153");
            AgentController             distrAgent = JadeHelper.CreateAgent(distrCont, "DistributorAgent", "Project_MASMA.DistributorAgent", null);

            distrCont.start();
            distrAgent.start();
        }
        public void GenerateHelperAgents(AID processorAgentId, int number)
        {
            String index;

            for (int i = 0; i < number; i++)
            {
                index = (i < 9) ? "0" + i : i.ToString();
                helperContainers.Add(JadeHelper.CreateContainer("container" + i, false, "localhost", null, "14" + index));
                helperAgents.Add(JadeHelper.CreateAgent(helperContainers[i], "HelperAgent" + i + processorAgentId.getLocalName(), "Project_MASMA.HelperAgent", null));
            }
            for (int i = 0; i < number; i++)
            {
                helperContainers[i].start();
                helperAgents[i].start();
            }
        }
        public void GenerateProcessorAgents()
        {
            String index;

            dispCont  = JadeHelper.CreateContainer("DispatcherContainer", false, "localhost", null, "1150");
            dispAgent = JadeHelper.CreateAgent(dispCont, "DispatcherAgent", "Project_MASMA.DispatcherAgent", null);

            for (int i = 0; i < Constants.ProcessorNumber; i++)
            {
                index = (i < 9) ? "0" + i : i.ToString();
                procCont.Add(JadeHelper.CreateContainer("container" + i, false, "localhost", null, "11" + index));
                procAgents.Add(JadeHelper.CreateAgent(procCont[i], "ProcessorAgent" + i, "Project_MASMA.ProcessorAgent", null));
            }
            dispAgent.start();
            for (int i = 0; i < Constants.ProcessorNumber; i++)
            {
                procCont[i].start();
                procAgents[i].start();
            }
        }