/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { ITransmissionPath offeringCasted = item.As <ITransmissionPath>(); if ((offeringCasted != null)) { this._parent.Offering.Add(offeringCasted); } ITransmissionProduct offeredAsCasted = item.As <ITransmissionProduct>(); if ((offeredAsCasted != null)) { this._parent.OfferedAs.Add(offeredAsCasted); } IAvailableTransmissionCapacity scheduledByCasted = item.As <IAvailableTransmissionCapacity>(); if ((scheduledByCasted != null)) { this._parent.ScheduledBy.Add(scheduledByCasted); } IServiceReservation reservedBy_ServiceReservationCasted = item.As <IServiceReservation>(); if ((reservedBy_ServiceReservationCasted != null)) { this._parent.ReservedBy_ServiceReservation.Add(reservedBy_ServiceReservationCasted); } if ((this._parent.TransContractFor == null)) { IOpenAccessProduct transContractForCasted = item.As <IOpenAccessProduct>(); if ((transContractForCasted != null)) { this._parent.TransContractFor = transContractForCasted; return; } } if ((this._parent.Offers == null)) { ITransmissionProvider offersCasted = item.As <ITransmissionProvider>(); if ((offersCasted != null)) { this._parent.Offers = offersCasted; return; } } }
/// <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) { ITransmissionPath transmissionPathItem = item.As <ITransmissionPath>(); if (((transmissionPathItem != null) && this._parent.Offering.Remove(transmissionPathItem))) { return(true); } ITransmissionProduct transmissionProductItem = item.As <ITransmissionProduct>(); if (((transmissionProductItem != null) && this._parent.OfferedAs.Remove(transmissionProductItem))) { return(true); } IAvailableTransmissionCapacity availableTransmissionCapacityItem = item.As <IAvailableTransmissionCapacity>(); if (((availableTransmissionCapacityItem != null) && this._parent.ScheduledBy.Remove(availableTransmissionCapacityItem))) { return(true); } IServiceReservation serviceReservationItem = item.As <IServiceReservation>(); if (((serviceReservationItem != null) && this._parent.ReservedBy_ServiceReservation.Remove(serviceReservationItem))) { return(true); } if ((this._parent.TransContractFor == item)) { this._parent.TransContractFor = null; return(true); } if ((this._parent.Offers == item)) { this._parent.Offers = null; return(true); } return(false); }