Ejemplo n.º 1
0
        /// <summary>
        /// stores the semi into the Inheritance element
        /// </summary>
        /// <param name="semi">the semi to be stored</param>
        public override void doActionInheritance(CSsemi.CSemiExp semi)
        {
            InheritanceElem       inheritanceelem = new InheritanceElem();
            PackageDependencyElem packageelem     = new PackageDependencyElem();
            Elem elem           = new Elem();
            bool existingParent = false;

            for (int i = 0; i < repo_.analyzedata.Count; i++)
            {
                elem = repo_.analyzedata[i];

                if (elem.type == "class" && semi[1] == elem.name)
                {
                    for (int j = 0; j < repo_.inheritancedata.Count; j++)
                    {
                        inheritanceelem = repo_.inheritancedata[j];
                        if (semi[1] == inheritanceelem.parent)
                        {
                            existingParent = true;
                            int index = repo_.inheritancedata.IndexOf(inheritanceelem);
                            inheritanceelem.children.Add(semi[0]);
                            inheritanceelem.childcount++;
                            repo_.inheritancedata.Remove(inheritanceelem);
                            repo_.inheritancedata.Insert(index, inheritanceelem);
                        }
                    }

                    if (!existingParent)
                    {
                        inheritanceelem = new InheritanceElem();
                        inheritanceelem.children.Add(semi[0]);
                        inheritanceelem.parent = semi[1];
                        inheritanceelem.childcount++;
                        repo_.inheritancedata.Add(inheritanceelem);
                    }

                    createPackageAnalysisList("Inheritance", semi, i);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// stores the semi into the Inheritance element
        /// </summary>
        /// <param name="semi">the semi to be stored</param>
        public override void doActionInheritance(CSsemi.CSemiExp semi)
        {
            InheritanceElem inheritanceelem = new InheritanceElem();
            PackageDependencyElem packageelem = new PackageDependencyElem();
            Elem elem = new Elem();
            bool existingParent = false;

            for (int i = 0; i < repo_.analyzedata.Count; i++)
            {
                elem = repo_.analyzedata[i];

                if (elem.type == "class" && semi[1] == elem.name)
                {
                    for (int j = 0; j < repo_.inheritancedata.Count; j++)
                    {
                        inheritanceelem = repo_.inheritancedata[j];
                        if (semi[1] == inheritanceelem.parent)
                        {
                            existingParent = true;
                            int index = repo_.inheritancedata.IndexOf(inheritanceelem);
                            inheritanceelem.children.Add(semi[0]);
                            inheritanceelem.childcount++;
                            repo_.inheritancedata.Remove(inheritanceelem);
                            repo_.inheritancedata.Insert(index, inheritanceelem);
                        }
                    }

                    if (!existingParent)
                    {
                        inheritanceelem = new InheritanceElem();
                        inheritanceelem.children.Add(semi[0]);
                        inheritanceelem.parent = semi[1];
                        inheritanceelem.childcount++;
                        repo_.inheritancedata.Add(inheritanceelem);
                    }

                    createPackageAnalysisList("Inheritance", semi, i);
                }
            }
        }