Ejemplo n.º 1
0
        public KPsystemXMLWriter(KPsystem kp)
        {
            kPsystem      = kp;
            model         = new Model();
            agentsInitial = new AgentsInitialConfiguration();
            objectsId     = new ObjectsId();
            typeId        = new Dictionary <string, int>();
            membraneId    = new MembraneId();
            membranes     = new Membranes(objectsId);
            FlameRulesGenerator     flameRulesGenerator     = new FlameRulesGenerator(objectsId, membraneId);
            FlameCodeRulesGenerator flameCodeRulesGenerator = new FlameCodeRulesGenerator(objectsId, membraneId);

            foreach (MType mType in kPsystem.Types)
            {
                typeId.Add(mType.Name, typeId.Count);
                membranes.AddMembraneType(mType);
                model.AddAgent(new Agent(mType, typeId[mType.Name], flameCodeRulesGenerator));
                Console.WriteLine(mType.Name);
            }
            foreach (MType mType in kPsystem.Types)
            {
                AgentMembrane agentMembrane = new AgentMembrane();
                agentMembrane.Name = mType.Name;
                agentMembrane.Id   = membraneId[mType.Name].ToString();
                List <int> list = flameCodeRulesGenerator.Rules(mType.ExecutionStrategy);
                foreach (MInstance mInstance in mType.Instances)
                {
                    agentMembrane.AddInstance(flameRulesGenerator.Multiset(mInstance.Multiset), mInstance, membranes, membraneId);
                }
                agentsInitial.AddMembrane(agentMembrane);
            }
        }
Ejemplo n.º 2
0
 public Membranes(ObjectsId objects)
 {
     objectsId         = objects;
     membranesType     = new Dictionary <string, KeyValuePair <MType, int> >();
     membranesInstance = new Dictionary <MInstance, KeyValuePair <string, int> >();
 }
Ejemplo n.º 3
0
 public FlameCodeRulesGenerator(ObjectsId objectsId, MembraneId membraneId)
 {
     this.objectsId  = objectsId;
     this.membraneId = membraneId;
 }