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)
            {
                IPlaceToTransition incomingArcCasted = item.As <IPlaceToTransition>();

                if ((incomingArcCasted != null))
                {
                    this._parent.IncomingArc.Add(incomingArcCasted);
                }
                ITransitionToPlace outgoingArcCasted = item.As <ITransitionToPlace>();

                if ((outgoingArcCasted != null))
                {
                    this._parent.OutgoingArc.Add(outgoingArcCasted);
                }
            }
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)
            {
                IPlaceToTransition placeToTransitionItem = item.As <IPlaceToTransition>();

                if (((placeToTransitionItem != null) &&
                     this._parent.IncomingArc.Remove(placeToTransitionItem)))
                {
                    return(true);
                }
                ITransitionToPlace transitionToPlaceItem = item.As <ITransitionToPlace>();

                if (((transitionToPlaceItem != null) &&
                     this._parent.OutgoingArc.Remove(transitionToPlaceItem)))
                {
                    return(true);
                }
                return(false);
            }