DataDictionary.Functions.Procedure.SetUpdateInformation C# (CSharp) Method

SetUpdateInformation() public method

Sets the update information for this procedure
public SetUpdateInformation ( ModelElement source ) : void
source ModelElement The source procedure this procedure updates
return void
        public override void SetUpdateInformation(ModelElement source)
        {
            base.SetUpdateInformation(source);
            Procedure sourceProcedure = (Procedure) source;

            // In addition to indicating the function's update information, we need to create links for each parameter
            foreach (Parameter parameter in FormalParameters)
            {
                Parameter baseParameter = sourceProcedure.GetFormalParameter(parameter.Name);
                if (baseParameter != null)
                {
                    parameter.SetUpdateInformation(baseParameter);
                }
            }

            foreach (Rule rule in Rules)
            {
                Rule baseRule = sourceProcedure.FindRule(rule.Name);
                if (baseRule != null)
                {
                    rule.SetUpdateInformation(baseRule);
                }
            }
        }

Usage Example

Exemplo n.º 1
0
        /// <summary>
        ///     Creates a copy of the procedure in the designated dictionary. The namespace structure is copied over.
        ///     The new procedure is set to update this one.
        /// </summary>
        /// <param name="dictionary">The target dictionary of the copy</param>
        /// <returns></returns>
        public Procedure CreateProcedureUpdate(Dictionary dictionary)
        {
            Procedure retVal = (Procedure)Duplicate();

            retVal.SetUpdateInformation(this);
            retVal.ClearAllRequirements();

            String[] names = FullName.Split('.');
            names = names.Take(names.Count() - 1).ToArray();

            if (Enclosing is NameSpace)
            {
                NameSpace nameSpace = dictionary.GetNameSpaceUpdate(names, Dictionary);
                nameSpace.appendProcedures(retVal);
            }
            else
            {
                String[] nameSpaceRef = names.Take(names.Count() - 1).ToArray();

                if (Enclosing is Structure)
                {
                    NameSpace nameSpace = dictionary.GetNameSpaceUpdate(nameSpaceRef, Dictionary);
                    Structure structure = nameSpace.GetStructureUpdate(names.Last(), (NameSpace)nameSpace.Updates);
                    structure.appendProcedures(retVal);
                }
            }

            return(retVal);
        }