Esempio n. 1
0
        public static List <ClassDiagram> GetDit(IEnumerable <XElement> generalizations, List <ClassDiagram> classDiagramList)
        {
            if (classDiagramList == null)
            {
                classDiagramList = new List <ClassDiagram>();
            }

            foreach (var generalization in generalizations)
            {
                String parentId = generalization.Element(c + "Object1").Element(o + "Class").Attribute("Ref").Value;
                String childId  = generalization.Element(c + "Object2").Element(o + "Class").Attribute("Ref").Value;

                classDiagramList.ForEach(cd =>
                {
                    if (cd.Id == childId)
                    {
                        cd.ParentId         = parentId;
                        ClassDiagram parent = GetClassDiagramById(classDiagramList, parentId);
                        cd.ParentName       = parent.Name;
                        cd.Dit = parent.Dit + 1;
                    }
                });
            }

            return(classDiagramList);
        }
Esempio n. 2
0
        public static ClassDiagram Attribute(IEnumerable <XElement> attributes, ClassDiagram cd)
        {
            if (cd == null)
            {
                cd = new ClassDiagram();
            }

            foreach (var attribute in attributes)
            {
                cd.AddAttribute(attribute.Element(a + "Name").Value);
            }

            return(cd);
        }
Esempio n. 3
0
        public static ClassDiagram Operation(IEnumerable <XElement> operations, ClassDiagram cd)
        {
            if (cd == null)
            {
                cd = new ClassDiagram();
            }

            foreach (var operation in operations)
            {
                Operation op = new Operation();
                op.Name = operation.Element(a + "Name").Value;
                op      = Parameter(operation.Elements(c + "Parameters").Elements(o + "Parameter"), op);

                cd.AddOperation(op);
            }

            return(cd);
        }
Esempio n. 4
0
        public static List <ClassDiagram> GetClass(IEnumerable <XElement> classes, List <ClassDiagram> classDiagramList)
        {
            if (classDiagramList == null)
            {
                classDiagramList = new List <ClassDiagram>();
            }

            foreach (var ele in classes)
            {
                ClassDiagram cd = new ClassDiagram();
                cd.Name = ele.Element(a + "Name").Value;
                cd.Id   = ele.Attribute("Id").Value;
                cd      = Attribute(ele.Elements(c + "Attributes").Elements(o + "Attribute"), cd);
                cd      = Operation(ele.Elements(c + "Operations").Elements(o + "Operation"), cd);
                classDiagramList.Add(cd);
            }

            return(classDiagramList);
        }