GetStructureUpdate() public method

Either provides the requested structure or creates it if it cannot be found
public GetStructureUpdate ( string name, NameSpace initialNameSpace ) : Structure
name string The name pf the structure
initialNameSpace NameSpace The namespace the structure is being copied from
return Structure
Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }