/// <summary>
        ///     Creates a copy of the function in the designated dictionary. The namespace structure is copied over.
        ///     The new function is set to update this one.
        /// </summary>
        /// <param name="dictionary">The target dictionary of the copy</param>
        /// <returns></returns>
        public Function CreateFunctionUpdate(Dictionary dictionary)
        {
            Function retVal = (Function) Duplicate();
            retVal.setUpdates(Guid);
            retVal.ClearAllRequirements();

            // In addition to indicating the function's update information, we need to create links for each parameter
            foreach (Parameter parameter in retVal.FormalParameters)
            {
                Parameter matchingParameter = GetFormalParameter(parameter.Name);
                parameter.setUpdates(matchingParameter.Guid);
            }

            String[] names = FullName.Split('.');
            names = names.Take(names.Count() - 1).ToArray();
            NameSpace nameSpace = dictionary.GetNameSpaceUpdate(names, Dictionary);
            nameSpace.appendFunctions(retVal);

            return retVal;
        }
Example #2
0
        /// <summary>
        ///     Creates a copy of the range in the designated dictionary. The namespace structure is copied over.
        ///     The new range is set to update this one.
        /// </summary>
        /// <param name="dictionary">The target dictionary of the copy</param>
        /// <returns></returns>
        public Range CreateRangeUpdate(Dictionary dictionary)
        {
            Range retVal = (Range) Duplicate();
            retVal.setUpdates(Guid);
            retVal.ClearAllRequirements();

            String[] names = FullName.Split('.');
            names = names.Take(names.Count() - 1).ToArray();
            NameSpace nameSpace = dictionary.GetNameSpaceUpdate(names, Dictionary);
            nameSpace.appendRanges(retVal);

            return retVal;
        }
        /// <summary>
        ///     Creates a copy of the state machine in the designated dictionary. The namespace structure is copied over.
        ///     The new state machine is set to update this one.
        /// </summary>
        /// <param name="dictionary">The target dictionary of the copy</param>
        /// <returns></returns>
        public StateMachine CreateStateMachineUpdate(Dictionary dictionary)
        {
            StateMachine retVal = new StateMachine();
            retVal.Name = Name;
            retVal.SetUpdateInformation(this);
            retVal.Requirements.Clear();

            String[] names = FullName.Split('.');

            String[] nameSpaceRef = NameSpace.FullName.Split('.');
            NameSpace nameSpace = dictionary.GetNameSpaceUpdate(nameSpaceRef, Dictionary);

            if (Enclosing is NameSpace)
            {
                nameSpace.appendStateMachines(retVal);
            }
            else if (Enclosing is Structure)
            {
                Structure structure = nameSpace.GetStructureUpdate(names.Last(), (NameSpace) nameSpace.Updates);
                structure.appendStateMachines(retVal);
            }

            return retVal;
        }
Example #4
0
        /// <summary>
        ///     Creates a copy of the structure in the designated dictionary. The namespace structure is copied over.
        ///     The new structure is set to update this one.
        /// </summary>
        /// <param name="dictionary">The target dictionary of the copy</param>
        /// <returns></returns>
        public Structure CreateStructureUpdate(Dictionary dictionary)
        {
            Structure retVal = (Structure)acceptor.getFactory().createStructure();
            retVal.Name = Name;
            retVal.Comment = Comment;
            retVal.IsAbstract = IsAbstract;
            retVal.SetUpdateInformation(this);

            String[] names = FullName.Split('.');
            names = names.Take(names.Count() - 1).ToArray();
            NameSpace nameSpace = dictionary.GetNameSpaceUpdate(names, Dictionary);
            nameSpace.appendStructures(retVal);

            return retVal;
        }
Example #5
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;
        }
 /// <summary>
 ///     Creates a copy of the namespace in the designated dictionary. The enclosing namespace structure is copied over.
 ///     The new namespace is set to update this one.
 /// </summary>
 /// <param name="dictionary">The target dictionary of the copy</param>
 /// <returns></returns>
 public NameSpace CreateUpdateInDictionary(Dictionary dictionary)
 {
     NameSpace retVal = dictionary.GetNameSpaceUpdate(FullName.Split('.'), Dictionary);
     return retVal;
 }
        /// <summary>
        ///     Creates a copy of the structure element in the designated dictionary. The namespace structure is copied over.
        ///     The new structure element is set to update this one.
        /// </summary>
        /// <param name="dictionary">The target dictionary of the copy</param>
        /// <returns></returns>
        public StructureElement CreateStructureElementUpdate(Dictionary dictionary)
        {
            StructureElement retVal = new StructureElement();
            retVal.Name = Name;
            retVal.TypeName = TypeName;
            retVal.Comment = Comment;
            retVal.setUpdates(Guid);

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

            NameSpace nameSpace = dictionary.GetNameSpaceUpdate(nameSpaceRef, Dictionary);
            Structure structure = nameSpace.GetStructureUpdate(names.Last(), (NameSpace)nameSpace.Updates);
            structure.appendElements(retVal);

            return retVal;
        }
Example #8
0
        /// <summary>
        ///     Creates a copy of the rule in the designated dictionary. The namespace structure is copied over.
        ///     The new rule is set to update this one.
        /// </summary>
        /// <param name="dictionary">The target dictionary of the copy</param>
        /// <returns></returns>
        public Rule CreateRuleUpdate(Dictionary dictionary)
        {
            Rule retVal = (Rule) 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.appendRules(retVal);
            }
            else
            {
                String[] nameSpaceRef = names.Take(names.Count() - 1).ToArray();

                if (EnclosingStateMachine != null)
                {
                    StateMachine stateMachine = EnclosingStateMachine.CreateSubStateMachineUpdate(dictionary);
                    stateMachine.appendRules(retVal);
                }
                else if (EnclosingStructure != null)
                {
                    NameSpace nameSpace = dictionary.GetNameSpaceUpdate(nameSpaceRef, Dictionary);
                    Structure structure = nameSpace.GetStructureUpdate(names.Last(), (NameSpace)nameSpace.Updates);
                    structure.appendRules(retVal);
                }
            }

            return retVal;
        }
Example #9
0
        /// <summary>
        ///     Creates a copy of the enum in the designated dictionary. The namespace structure is copied over.
        ///     The new enum is set to update this one.
        /// </summary>
        /// <param name="dictionary">The target dictionary of the copy</param>
        /// <returns></returns>
        public Enum CreateEnumUpdate(Dictionary dictionary)
        {
            Enum retVal = (Enum) GetTopLevelEnum().Duplicate();
            retVal.SetUpdateInformation(GetTopLevelEnum());
            retVal.ClearAllRequirements();

            String[] names = GetTopLevelEnum().FullName.Split('.');
            names = names.Take(names.Count() - 1).ToArray();
            NameSpace nameSpace = dictionary.GetNameSpaceUpdate(names, Dictionary);
            if (nameSpace != null)
            {
                nameSpace.appendEnumerations(retVal);
            }

            return retVal;
        }