/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { IInPortB inputPortsCasted = item.As <IInPortB>(); if ((inputPortsCasted != null)) { this._parent.InputPorts.Add(inputPortsCasted); } IOutPortB outputPortsCasted = item.As <IOutPortB>(); if ((outputPortsCasted != null)) { this._parent.OutputPorts.Add(outputPortsCasted); } }
/// <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) { IInPortB inPortBItem = item.As <IInPortB>(); if (((inPortBItem != null) && this._parent.InputPorts.Remove(inPortBItem))) { return(true); } IOutPortB outPortBItem = item.As <IOutPortB>(); if (((outPortBItem != null) && this._parent.OutputPorts.Remove(outPortBItem))) { return(true); } return(false); }