public static IList <EvolutionChange> Detect(Version v1, Version v2, PSMClassUnion classUnion)
        {
            List <EvolutionChange> result = new List <EvolutionChange>();

            PSMClassUnion classUnionOldVersion =
                (PSMClassUnion)classUnion.GetInVersion(v1);

            foreach (PSMAssociationChild associationChild in classUnionOldVersion.Components)
            {
                /* must not exist in new version, testing whether it disappeard from components of the new
                 * version is not enough. It could have been moved, but not deleted.
                 */
                if (associationChild.GetInVersion(v2) == null)
                {
                    ClassUnionComponentRemovedChange change =
                        new ClassUnionComponentRemovedChange(classUnion)
                    {
                        RemovedComponent = associationChild,
                        OldVersion       = v1,
                        NewVersion       = v2
                    };
                    result.Add(change);
                }
            }
            return(result);
        }
Esempio n. 2
0
        public static IList <EvolutionChange> Detect(Version v1, Version v2, PSMClassUnion classUnion)
        {
            List <EvolutionChange> result = new List <EvolutionChange>();

            PSMClassUnion oldVersion = (PSMClassUnion)classUnion.GetInVersion(v1);
            PSMClassUnion newVersion = (PSMClassUnion)classUnion.GetInVersion(v2);

            if (newVersion != null && oldVersion != null &&
                oldVersion.ParentAssociation != newVersion.ParentAssociation.GetInVersion(v1))
            {
                result.Add(new ClassUnionMovedChange(classUnion)
                {
                    OldVersion = v1, NewVersion = v2
                });
            }

            return(result);
        }