示例#1
0
 public void AddGateIn(Gate _gateIn)
 {
     gateIn.Add(_gateIn);
 }
示例#2
0
 public void AddGateOut(Gate _gateOut)
 {
     gateOut.Add(_gateOut);
 }
示例#3
0
        public void GetEntity(ComponentEntity component)
        {
            int ingexOfEntity = 0;

            int indexOfPort = 0;

            int indexOfEnd = 0;

            string entityName = "";


            ingexOfEntity = listContent.IndexOf("entity");
            if (ingexOfEntity != 0)
            {
                entityName = listContent[ingexOfEntity + 1];
            }

            component.componentName = entityName;

            for (int i = 0; i < listContent.Count(); i++)
            {
                if (listContent[i].Contains("port"))
                {
                    indexOfPort = i;
                    break;
                }
            }

            indexOfEnd = listContent.IndexOf("end");

            if (indexOfPort != 0 && indexOfEnd != 0)
            {
                for (int i = indexOfPort; i < indexOfEnd; i++)
                {
                    listEntity.Add(listContent[i]);
                }
            }


            int indexOfAccessMode = 0;

            string typeOfGate = "";

            int currentPos = 0;

            string accessMode = "";

            int dimension = 0;

            while (currentPos < listEntity.Count())
            {
                if (ContainWord(currentPos, ref accessMode))
                {
                    dimension = 0;
                    GetTypeOfGate(ref currentPos, out typeOfGate, ref indexOfAccessMode, accessMode, ref dimension);

                    List <string> listCurrentGate = new List <string>();

                    GetGates(currentPos, indexOfAccessMode, listCurrentGate);

                    foreach (string entry in listCurrentGate)
                    {
                        Gate gate = new Gate(entry, typeOfGate, accessMode);

                        if (dimension > 0)
                        {
                            gate.dimension = dimension;
                        }

                        component.AddGate(gate);
                    }

                    FindNextPart(indexOfAccessMode, ref currentPos);
                }
            }
        }