Ejemplo n.º 1
0
        public override void Execute(UMLRelationship r, ActionMap map, List <PreFile> prefiles)
        {
            UMLClass a            = null;
            UMLClass b            = null;
            UMLClass ac           = null;
            int      defaultDetsA = 0;
            int      defaultDetsB = 0;
            PreFile  prefA;
            PreFile  prefB;
            PreRET   temp;

            RelationshipHelper.GetClasses(r, ref a, ref b, this.IsAlternate, ref defaultDetsA, ref defaultDetsB);


            if (r is UMLAssociation)
            {
                ac = ((UMLAssociation)r).AssociationClass;
            }

            prefA = PreFileHelper.GetPreFileWithClass(a, prefiles);
            prefB = PreFileHelper.GetPreFileWithClass(b, prefiles);

            if (prefA == null)
            {
                if (prefB == null)
                {
                    prefA = new PreFile();
                    prefA.Rets.Add(new PreRET());
                    prefA.Rets.Add(new PreRET());
                    prefA.Rets[0].Classes.Add(a);
                    prefA.Rets[1].Classes.Add(b);
                    prefiles.Add(prefA);

                    if (ac != null)
                    {
                        prefA.Rets.Add(new PreRET());
                        prefA.Rets[2].Classes.Add(ac);
                    }
                }
                else
                {
                    temp = new PreRET();
                    temp.Classes.Add(a);
                    prefB.Rets.Add(temp);
                }
            }
            else
            {
                if (prefB == null)
                {
                    temp = new PreRET();
                    temp.Classes.Add(b);
                    prefA.Rets.Add(temp);
                }
            }
        }
Ejemplo n.º 2
0
        public override void Execute(UMLRelationship r, ActionMap map, List <PreFile> prefiles)
        {
            UMLClass a            = null;
            UMLClass b            = null;
            UMLClass ac           = null;
            int      defaultDetsA = 0;
            int      defaultDetsB = 0;
            PreFile  prefA;
            PreFile  prefB;

            RelationshipHelper.GetClasses(r, ref a, ref b, this.IsAlternate, ref defaultDetsA, ref defaultDetsB);


            if (r is UMLAssociation)
            {
                ac = ((UMLAssociation)r).AssociationClass;
            }

            prefA = PreFileHelper.GetPreFileWithClass(a, prefiles);
            prefB = PreFileHelper.GetPreFileWithClass(b, prefiles);

            if (prefA == null)
            {
                if (prefB == null)
                {
                    prefA = new PreFile();
                    prefA.Rets.Add(new PreRET());
                    prefA.Rets[0].Classes.Add(a);
                    prefA.Rets[0].Classes.Add(b);

                    if (ac != null)
                    {
                        prefA.Rets[0].Classes.Add(ac);
                    }

                    prefiles.Add(prefA);
                }
                else
                {
                    foreach (PreRET ret in PreFileHelper.GetPreRETsWithClass(b, prefB))
                    {
                        ret.Classes.Add(a);
                        if (ac != null)
                        {
                            ret.Classes.Add(ac);
                        }
                    }
                }
            }
            else
            {
                if (prefB == null)
                {
                    foreach (PreRET ret in PreFileHelper.GetPreRETsWithClass(a, prefA))
                    {
                        ret.Classes.Add(b);
                        if (ac != null)
                        {
                            ret.Classes.Add(ac);
                        }
                    }
                }
                else
                {
                    foreach (PreRET reta in PreFileHelper.GetPreRETsWithClass(a, prefA))
                    {
                        foreach (PreRET retb in PreFileHelper.GetPreRETsWithClass(b, prefB))
                        {
                            reta.Merge(retb);
                            prefB.Rets.Remove(retb);

                            if (ac != null)
                            {
                                reta.Classes.Add(ac);
                            }
                        }
                    }

                    prefA.Merge(prefB);
                    prefiles.Remove(prefB);
                }
            }
        }
Ejemplo n.º 3
0
        public override void Execute(UMLRelationship r, ActionMap map, List <PreFile> prefiles)
        {
            UMLClass a            = null;
            UMLClass b            = null;
            int      defaultDetsA = 0;
            int      defaultDetsB = 0;
            PreFile  prefA;
            PreFile  prefB;
            PreRET   temp;

            RelationshipHelper.GetClasses(r, ref a, ref b, this.IsAlternate, ref defaultDetsA, ref defaultDetsB);

            prefA = PreFileHelper.GetPreFileWithClass(a, prefiles);
            prefB = PreFileHelper.GetPreFileWithClass(b, prefiles);

            if (prefA == null)
            {
                if (prefB == null)
                {
                    prefA = new PreFile();
                    prefA.Rets.Add(new PreRET());
                    prefA.Rets.Add(new PreRET());
                    prefA.Rets[0].Classes.Add(a);
                    prefA.Rets[1].Classes.Add(b);
                    prefA.Rets[1].Parents.Add(prefA.Rets[0]);

                    prefiles.Add(prefA);
                }
                else
                {
                    temp = new PreRET();
                    temp.Classes.Add(a);
                    prefB.Rets.Add(temp);

                    foreach (PreRET ret in PreFileHelper.GetPreRETsWithClass(b, prefB))
                    {
                        ret.Parents.Add(temp);
                    }
                }
            }
            else
            {
                if (prefB == null)
                {
                    temp = new PreRET();
                    temp.Classes.Add(b);
                    prefA.Rets.Add(temp);

                    foreach (PreRET ret in PreFileHelper.GetPreRETsWithClass(a, prefA))
                    {
                        temp.Parents.Add(ret);
                    }
                }
                else
                {
                    foreach (PreRET retparent in PreFileHelper.GetPreRETsWithClass(a, prefA))
                    {
                        foreach (PreRET retchild in PreFileHelper.GetPreRETsWithClass(b, prefB))
                        {
                            retchild.Parents.Add(retparent);
                            //Merging to form the Real RET is done in the FileProcessing
                        }
                    }

                    prefA.Merge(prefB);
                    prefiles.Remove(prefB);
                }
            }
        }
Ejemplo n.º 4
0
        public override void Execute(UMLRelationship r, ActionMap map, List <PreFile> prefiles)
        {
            UMLClass a = null;
            UMLClass b = null;
            int      defaultDetsA = 0;
            int      defaultDetsB = 0;
            PreFile  temp, tempA, tempB;

            RelationshipHelper.GetClasses(r, ref a, ref b, this.IsAlternate, ref defaultDetsA, ref defaultDetsB);

            //1st File
            if ((tempA = PreFileHelper.GetPreFileWithClass(a, prefiles)) == null)
            {
                tempA = new PreFile();
                tempA.Rets.Add(new PreRET());
                tempA.Rets[0].Classes.Add(a);
                prefiles.Add(tempA);
            }
            tempA.DefaultDets += defaultDetsA;

            //2nd File
            if ((tempB = PreFileHelper.GetPreFileWithClass(b, prefiles)) == null)
            {
                tempB = new PreFile();
                tempB.Rets.Add(new PreRET());
                tempB.Rets[0].Classes.Add(b);
                prefiles.Add(tempB);
            }

            tempB.DefaultDets += defaultDetsB;

            //3rd File (only if there is an Association-Class)
            if (r is UMLAssociation)
            {
                if (((UMLAssociation)r).AssociationClass != null)
                {
                    UMLClass dependencyClass             = null;
                    UMLClass associationClass            = ((UMLAssociation)r).AssociationClass;
                    UMLDependencyCollection dependencies = associationClass.GetDependencies();

                    foreach (UMLDependency d in dependencies)
                    {
                        d.Client   = Helper.GetDependencyClient <UMLClass>(d.Guid);
                        d.Supplier = Helper.GetDependencySupplier <UMLClass>(d.Guid);

                        if ((d.Client.Guid == associationClass.Guid && d.Supplier.Guid == a.Guid) ||
                            (d.Supplier.Guid == associationClass.Guid && d.Client.Guid == a.Guid))
                        {
                            dependencyClass = a;
                        }
                        else if ((d.Client.Guid == associationClass.Guid && d.Supplier.Guid == b.Guid) ||
                                 (d.Supplier.Guid == associationClass.Guid && d.Client.Guid == b.Guid))
                        {
                            dependencyClass = b;
                        }
                    }
                    if (dependencyClass == null)
                    {
                        //temp = PreFileHelper.GetPreFileWithClass(a, prefiles);
                        //if (temp == null)
                        temp = new PreFile();
                        temp.Rets.Add(new PreRET());
                        temp.Rets[0].Classes.Add(((UMLAssociation)r).AssociationClass);
                        prefiles.Add(temp);
                    }
                    else if (dependencyClass == a)
                    {
                        PreRET pret = new PreRET();
                        pret.Classes.Add(associationClass);
                        tempA.Rets.Add(pret);
                    }
                    else if (dependencyClass == b)
                    {
                        PreRET pret = new PreRET();
                        pret.Classes.Add(associationClass);
                        tempB.Rets.Add(pret);
                    }
                }
            }
        }