示例#1
0
        public override void FillCopy(Element copyElement, Model targetModel, ElementCopiesMap createdCopies)
        {
            base.FillCopy(copyElement, targetModel, createdCopies);
            _PSMClassUnion copyPSMClassUnion = (_PSMClassUnion)copyElement;

            if (ParentAssociation != null && createdCopies.ContainsKey(ParentAssociation))
            {
                copyPSMClassUnion.ParentAssociation = createdCopies[ParentAssociation] as PSMAssociation;
            }

            if (ParentUnion != null && createdCopies.ContainsKey(ParentUnion))
            {
                copyPSMClassUnion.ParentUnion = createdCopies[ParentUnion] as PSMClassUnion;
            }
        }
示例#2
0
        public override void FillCopy(Element copyElement, Model targetModel, ElementCopiesMap createdCopies)
        {
            base.FillCopy(copyElement, targetModel, createdCopies);
            PSMAssociation copyPSMAssociation = (PSMAssociation)copyElement;

            copyPSMAssociation.Lower = Lower;
            copyPSMAssociation.Upper = Upper;
            //copyPSMAssociation.IsUnique = IsUnique;
            //copyPSMAssociation.IsOrdered = IsOrdered;
            copyPSMAssociation.Child = (PSMAssociationChild)createdCopies[Child];
            foreach (NestingJoin nestingJoin in NestingJoins)
            {
                PIMClass coreClass;
                if (targetModel.Schema != this.Schema)
                {
                    coreClass = (PIMClass)createdCopies[nestingJoin.CoreClass];
                }
                else
                {
                    coreClass = nestingJoin.CoreClass;
                }
                copyPSMAssociation.AddNestingJoin(coreClass);
            }

            if (Parent != null && createdCopies.ContainsKey(Parent))
            {
                PSMSuperordinateComponent copyParent = (PSMSuperordinateComponent)createdCopies[Parent];
                ((_ImplPSMSubordinateComponent)copyPSMAssociation).Parent = copyParent;
                copyParent.Components.Add(copyPSMAssociation);
            }
        }
示例#3
0
        public override void FillCopy(Element copyElement, Model targetModel, ElementCopiesMap createdCopies)
        {
            base.FillCopy(copyElement, targetModel, createdCopies);
            TypedElement copyTypedElement = (TypedElement)copyElement;

            if (Type != null)
            {
                if (createdCopies.ContainsKey(Type))
                {
                    copyTypedElement.Type = (DataType)createdCopies[Type];
                }
                else
                {
                    if (Schema == targetModel.Schema)
                    {
                        if (Type is SimpleDataType)
                        {
                            copyTypedElement.Type = Type;
                        }
                        else
                        {
                            //TODO: copy typed element
                            throw new NotImplementedException();
                        }
                    }
                }
            }
        }
示例#4
0
        public override void FillCopy(Element copyElement, Model targetModel, ElementCopiesMap createdCopies)
        {
            base.FillCopy(copyElement, targetModel, createdCopies);
            PSMContentChoice copyPSMContentChoice = (PSMContentChoice)copyElement;

            if (Parent != null && createdCopies.ContainsKey(Parent))
            {
                PSMSuperordinateComponent copyParent = (PSMSuperordinateComponent)createdCopies[Parent];
                ((_ImplPSMSubordinateComponent)copyPSMContentChoice).Parent = (PSMSuperordinateComponent)createdCopies[Parent];
                copyParent.Components.Add(copyPSMContentChoice);
            }
        }
示例#5
0
文件: _Package.cs 项目: mff-uk/xcase
 public override Element Clone(Model targetModel, ElementCopiesMap createdCopies)
 {
     if (targetModel != Schema.Model || createdCopies.ContainsKey(NestingPackage))
     {
         Package parentPackage = (Package)createdCopies[NestingPackage];
         return(parentPackage.AddNestedPackage());
     }
     else
     {
         return(NestingPackage.AddNestedPackage());
     }
 }
示例#6
0
        public override void FillCopy(Element copyElement, Model targetModel, ElementCopiesMap createdCopies)
        {
            base.FillCopy(copyElement, targetModel, createdCopies);
            PSMAttribute copyPSMAttribute = (PSMAttribute)copyElement;

            copyPSMAttribute.Alias             = Alias;
            copyPSMAttribute.XSDImplementation = XSDImplementation;

            if (UsedGeneralizations.Count == 0)
            {
                if (this.RepresentedAttribute != null)
                {
                    int attributeIndex = this.Class.RepresentedClass.Attributes.IndexOf(this.RepresentedAttribute);

                    if (attributeIndex >= 0)
                    {
                        copyPSMAttribute.RepresentedAttribute = copyPSMAttribute.Class.RepresentedClass.Attributes[attributeIndex];
                    }
                }
            }
            else
            {
                foreach (Generalization generalization in this.UsedGeneralizations)
                {
                    Generalization copyGeneralization;
                    if (targetModel != Schema.Model || createdCopies.ContainsKey(generalization))
                    {
                        copyGeneralization = (Generalization)createdCopies[generalization];
                    }
                    else
                    {
                        copyGeneralization = generalization;
                    }
                    copyPSMAttribute.UsedGeneralizations.Add(copyGeneralization);

                    if (this.RepresentedAttribute != null)
                    {
                        int attributeIndex = generalization.General.Attributes.IndexOf(this.RepresentedAttribute);
                        if (attributeIndex >= 0)
                        {
                            copyPSMAttribute.RepresentedAttribute = copyGeneralization.General.Attributes[attributeIndex];
                        }
                    }
                }
            }


            if (this.RepresentedAttribute != null && copyPSMAttribute.RepresentedAttribute == null)
            {
                throw new InvalidOperationException("Faild to copy psm class. ");
            }
        }
示例#7
0
文件: _PSMClass.cs 项目: mff-uk/xcase
        public override void FillCopy(Element copyElement, Model targetModel, ElementCopiesMap createdCopies)
        {
            base.FillCopy(copyElement, targetModel, createdCopies);
            PSMClass copyPSMClass = (PSMClass)copyElement;

            copyPSMClass.ElementName       = ElementName;
            copyPSMClass.AllowAnyAttribute = AllowAnyAttribute;


            if (ParentAssociation != null)
            {
                if (createdCopies.ContainsKey(ParentAssociation))
                {
                    ((_PSMClass)copyPSMClass).ParentAssociation = (PSMAssociation)createdCopies[ParentAssociation];
                }
                // will be added later I suppose

                //else if (targetModel != Schema.Model)
                //{
                //    throw new InvalidOperationException("Missing parent association among created copies");
                //}
            }
            if (ParentUnion != null)
            {
                if (createdCopies.ContainsKey(ParentUnion))
                {
                    ((PSMClassUnion)createdCopies[ParentUnion]).Components.Add(copyPSMClass);
                }
                // will be added later I suppose

                //else if (targetModel != Schema.Model)
                //{
                //    throw new InvalidOperationException("Missing parent union among created copies");
                //}
            }
        }
示例#8
0
文件: _Comment.cs 项目: mff-uk/xcase
        public override Element Clone(Model targetModel, ElementCopiesMap createdCopies)
        {
            Element _annotatedElement;

            if (targetModel != this.Schema.Model || createdCopies.ContainsKey(AnnotatedElement))
            {
                _annotatedElement = createdCopies[AnnotatedElement];
            }
            else
            {
                _annotatedElement = AnnotatedElement;
            }
            Comment clone = new _Comment(_annotatedElement, targetModel.Schema);

            return(clone);
        }
示例#9
0
文件: _DataType.cs 项目: mff-uk/xcase
        public override void FillCopy(Element copyElement, Model targetModel, ElementCopiesMap createdCopies)
        {
            base.FillCopy(copyElement, targetModel, createdCopies);
            _DataType <NUmlType> copyDataType = (_DataType <NUmlType>)copyElement;

            if (Package != null)
            {
                if (targetModel.Schema != this.Schema || createdCopies.ContainsKey(Package))
                {
                    copyDataType.Package = (Package)createdCopies[Package];
                }
                else
                {
                    copyDataType.Package = Package;
                }
            }
        }
示例#10
0
        public override void FillCopy(Element copyElement, Model targetModel, ElementCopiesMap createdCopies)
        {
            base.FillCopy(copyElement, targetModel, createdCopies);
            PSMAttributeContainer copyPSMAttributeContainer = (PSMAttributeContainer)copyElement;

            SubElementCopiesMap subElementCopiesMap = createdCopies.GetSubElementsList(this);

            foreach (PSMAttribute psmAttribute in PSMAttributes)
            {
                PSMAttribute copyAttribute = copyPSMAttributeContainer.AddAttribute();
                psmAttribute.FillCopy(copyAttribute, targetModel, createdCopies);
                subElementCopiesMap[psmAttribute] = copyAttribute;
            }

            if (Parent != null && createdCopies.ContainsKey(Parent))
            {
                PSMSuperordinateComponent copyParent = (PSMSuperordinateComponent)createdCopies[Parent];
                ((_ImplPSMSubordinateComponent)copyPSMAttributeContainer).Parent = copyParent;
                copyParent.Components.Add(copyPSMAttributeContainer);
            }
        }