/// <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) { ICustomerAgreement customerAgreementItem = item.As <ICustomerAgreement>(); if (((customerAgreementItem != null) && this._parent.CustomerAgreements.Remove(customerAgreementItem))) { return(true); } if ((this._parent.ValidityInterval == item)) { this._parent.ValidityInterval = null; return(true); } IEndDeviceGroup endDeviceGroupItem = item.As <IEndDeviceGroup>(); if (((endDeviceGroupItem != null) && this._parent.EndDeviceGroups.Remove(endDeviceGroupItem))) { return(true); } IEndDeviceControl endDeviceControlItem = item.As <IEndDeviceControl>(); if (((endDeviceControlItem != null) && this._parent.EndDeviceControls.Remove(endDeviceControlItem))) { 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) { ICustomerAgreement customerAgreementsCasted = item.As <ICustomerAgreement>(); if ((customerAgreementsCasted != null)) { this._parent.CustomerAgreements.Add(customerAgreementsCasted); } if ((this._parent.ValidityInterval == null)) { IDateTimeInterval validityIntervalCasted = item.As <IDateTimeInterval>(); if ((validityIntervalCasted != null)) { this._parent.ValidityInterval = validityIntervalCasted; return; } } IEndDeviceGroup endDeviceGroupsCasted = item.As <IEndDeviceGroup>(); if ((endDeviceGroupsCasted != null)) { this._parent.EndDeviceGroups.Add(endDeviceGroupsCasted); } IEndDeviceControl endDeviceControlsCasted = item.As <IEndDeviceControl>(); if ((endDeviceControlsCasted != null)) { this._parent.EndDeviceControls.Add(endDeviceControlsCasted); } }