/// <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) { ICUGroup cUGroupItem = item.As <ICUGroup>(); if (((cUGroupItem != null) && this._parent.ChildCUGroups.Remove(cUGroupItem))) { return(true); } if (((cUGroupItem != null) && this._parent.ParentCUGroups.Remove(cUGroupItem))) { return(true); } IDesignLocationCU designLocationCUItem = item.As <IDesignLocationCU>(); if (((designLocationCUItem != null) && this._parent.DesignLocationCUs.Remove(designLocationCUItem))) { return(true); } ICompatibleUnit compatibleUnitItem = item.As <ICompatibleUnit>(); if (((compatibleUnitItem != null) && this._parent.CompatibleUnits.Remove(compatibleUnitItem))) { return(true); } if ((this._parent.Status == item)) { this._parent.Status = null; return(true); } return(false); }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { ICUGroup childCUGroupsCasted = item.As <ICUGroup>(); if ((childCUGroupsCasted != null)) { this._parent.ChildCUGroups.Add(childCUGroupsCasted); } ICUGroup parentCUGroupsCasted = item.As <ICUGroup>(); if ((parentCUGroupsCasted != null)) { this._parent.ParentCUGroups.Add(parentCUGroupsCasted); } IDesignLocationCU designLocationCUsCasted = item.As <IDesignLocationCU>(); if ((designLocationCUsCasted != null)) { this._parent.DesignLocationCUs.Add(designLocationCUsCasted); } ICompatibleUnit compatibleUnitsCasted = item.As <ICompatibleUnit>(); if ((compatibleUnitsCasted != null)) { this._parent.CompatibleUnits.Add(compatibleUnitsCasted); } if ((this._parent.Status == null)) { IStatus statusCasted = item.As <IStatus>(); if ((statusCasted != null)) { this._parent.Status = statusCasted; return; } } }