/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { if ((this._parent.ProtectedSwitch == null)) { IProtectedSwitch protectedSwitchCasted = item.As <IProtectedSwitch>(); if ((protectedSwitchCasted != null)) { this._parent.ProtectedSwitch = protectedSwitchCasted; 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) { IConductingEquipment conductingEquipmentItem = item.As <IConductingEquipment>(); if (((conductingEquipmentItem != null) && this._parent.ConductingEquipments.Remove(conductingEquipmentItem))) { return(true); } if ((this._parent.Unit == item)) { this._parent.Unit = null; return(true); } IProtectedSwitch protectedSwitchItem = item.As <IProtectedSwitch>(); if (((protectedSwitchItem != null) && this._parent.ProtectedSwitches.Remove(protectedSwitchItem))) { 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) { IConductingEquipment conductingEquipmentsCasted = item.As <IConductingEquipment>(); if ((conductingEquipmentsCasted != null)) { this._parent.ConductingEquipments.Add(conductingEquipmentsCasted); } if ((this._parent.Unit == null)) { IUnit unitCasted = item.As <IUnit>(); if ((unitCasted != null)) { this._parent.Unit = unitCasted; return; } } IProtectedSwitch protectedSwitchesCasted = item.As <IProtectedSwitch>(); if ((protectedSwitchesCasted != null)) { this._parent.ProtectedSwitches.Add(protectedSwitchesCasted); } }