/// <summary> /// Duplicates this model element /// </summary> /// <returns></returns> public State duplicate() { State retVal = (State)Generated.acceptor.getFactory().createState(); retVal.Name = Name; retVal.X = X; retVal.Y = Y; retVal.Width = Width; retVal.Height = Height; retVal.setFather(getFather()); retVal.StateMachine = StateMachine.instanciate(); return(retVal); }
/// <summary> /// Creates a copy of the state in the designated dictionary. The namespace structure is copied over. /// The new state is set to update this one. /// </summary> /// <param name="dictionary">The target dictionary of the copy</param> /// <returns></returns> public State CreateStateUpdate(Dictionary dictionary) { State retVal = (State)acceptor.getFactory().createState(); retVal.Name = Name; retVal.SetUpdateInformation(this); // Find the update for the enclosing state machine to add retVal to StateMachine enclosingSmUpdate = EnclosingStateMachine.CreateSubStateMachineUpdate(dictionary); enclosingSmUpdate.States.Add(retVal); retVal.setFather(enclosingSmUpdate); // If retVal is the first state added to the enclosing state machine update, it is the initial state if (enclosingSmUpdate.States.Count == 1) { enclosingSmUpdate.Default = retVal.Name; } return(retVal); }