Example #1
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                ISubAction subActionsCasted = item.As <ISubAction>();

                if ((subActionsCasted != null))
                {
                    this._parent.SubActions.Add(subActionsCasted);
                }
                if ((this._parent.Outgoing == null))
                {
                    IOutgoing outgoingCasted = item.As <IOutgoing>();
                    if ((outgoingCasted != null))
                    {
                        this._parent.Outgoing = outgoingCasted;
                        return;
                    }
                }
                if ((this._parent.Incoming == null))
                {
                    IIncoming incomingCasted = item.As <IIncoming>();
                    if ((incomingCasted != null))
                    {
                        this._parent.Incoming = incomingCasted;
                        return;
                    }
                }
            }
Example #2
0
            /// <summary>
            /// Removes the given item from the collection
            /// </summary>
            /// <returns>True, if the item was removed, otherwise False</returns>
            /// <param name="item">The item that should be removed</param>
            public override bool Remove(IModelElement item)
            {
                ISubAction subActionItem = item.As <ISubAction>();

                if (((subActionItem != null) &&
                     this._parent.SubActions.Remove(subActionItem)))
                {
                    return(true);
                }
                if ((this._parent.Outgoing == item))
                {
                    this._parent.Outgoing = null;
                    return(true);
                }
                if ((this._parent.Incoming == item))
                {
                    this._parent.Incoming = null;
                    return(true);
                }
                return(false);
            }