/// <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) { ITailbayLossCurve tailbayLossCurveItem = item.As <ITailbayLossCurve>(); if (((tailbayLossCurveItem != null) && this._parent.TailbayLossCurve.Remove(tailbayLossCurveItem))) { return(true); } if ((this._parent.HydroPowerPlant == item)) { this._parent.HydroPowerPlant = null; return(true); } IHydroGeneratingEfficiencyCurve hydroGeneratingEfficiencyCurveItem = item.As <IHydroGeneratingEfficiencyCurve>(); if (((hydroGeneratingEfficiencyCurveItem != null) && this._parent.HydroGeneratingEfficiencyCurves.Remove(hydroGeneratingEfficiencyCurveItem))) { return(true); } if ((this._parent.PenstockLossCurve == item)) { this._parent.PenstockLossCurve = 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) { ITailbayLossCurve tailbayLossCurveCasted = item.As <ITailbayLossCurve>(); if ((tailbayLossCurveCasted != null)) { this._parent.TailbayLossCurve.Add(tailbayLossCurveCasted); } if ((this._parent.HydroPowerPlant == null)) { IHydroPowerPlant hydroPowerPlantCasted = item.As <IHydroPowerPlant>(); if ((hydroPowerPlantCasted != null)) { this._parent.HydroPowerPlant = hydroPowerPlantCasted; return; } } IHydroGeneratingEfficiencyCurve hydroGeneratingEfficiencyCurvesCasted = item.As <IHydroGeneratingEfficiencyCurve>(); if ((hydroGeneratingEfficiencyCurvesCasted != null)) { this._parent.HydroGeneratingEfficiencyCurves.Add(hydroGeneratingEfficiencyCurvesCasted); } if ((this._parent.PenstockLossCurve == null)) { IPenstockLossCurve penstockLossCurveCasted = item.As <IPenstockLossCurve>(); if ((penstockLossCurveCasted != null)) { this._parent.PenstockLossCurve = penstockLossCurveCasted; return; } } }