/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { IProtectionEquipment protectionEquipmentsCasted = item.As <IProtectionEquipment>(); if ((protectionEquipmentsCasted != null)) { this._parent.ProtectionEquipments.Add(protectionEquipmentsCasted); } IOutageStepPsrRole outageStepRolesCasted = item.As <IOutageStepPsrRole>(); if ((outageStepRolesCasted != null)) { this._parent.OutageStepRoles.Add(outageStepRolesCasted); } if ((this._parent.BaseVoltage == null)) { IBaseVoltage baseVoltageCasted = item.As <IBaseVoltage>(); if ((baseVoltageCasted != null)) { this._parent.BaseVoltage = baseVoltageCasted; return; } } IClearanceTag clearanceTagsCasted = item.As <IClearanceTag>(); if ((clearanceTagsCasted != null)) { this._parent.ClearanceTags.Add(clearanceTagsCasted); } if ((this._parent.SvStatus == null)) { ISvStatus svStatusCasted = item.As <ISvStatus>(); if ((svStatusCasted != null)) { this._parent.SvStatus = svStatusCasted; return; } } IElectricalAsset electricalAssetsCasted = item.As <IElectricalAsset>(); if ((electricalAssetsCasted != null)) { this._parent.ElectricalAssets.Add(electricalAssetsCasted); } ITerminal terminalsCasted = item.As <ITerminal>(); if ((terminalsCasted != null)) { this._parent.Terminals.Add(terminalsCasted); } }
/// <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) { IProtectionEquipment protectionEquipmentItem = item.As <IProtectionEquipment>(); if (((protectionEquipmentItem != null) && this._parent.ProtectionEquipments.Remove(protectionEquipmentItem))) { return(true); } IOutageStepPsrRole outageStepPsrRoleItem = item.As <IOutageStepPsrRole>(); if (((outageStepPsrRoleItem != null) && this._parent.OutageStepRoles.Remove(outageStepPsrRoleItem))) { return(true); } if ((this._parent.BaseVoltage == item)) { this._parent.BaseVoltage = null; return(true); } IClearanceTag clearanceTagItem = item.As <IClearanceTag>(); if (((clearanceTagItem != null) && this._parent.ClearanceTags.Remove(clearanceTagItem))) { return(true); } if ((this._parent.SvStatus == item)) { this._parent.SvStatus = null; return(true); } IElectricalAsset electricalAssetItem = item.As <IElectricalAsset>(); if (((electricalAssetItem != null) && this._parent.ElectricalAssets.Remove(electricalAssetItem))) { return(true); } ITerminal terminalItem = item.As <ITerminal>(); if (((terminalItem != null) && this._parent.Terminals.Remove(terminalItem))) { return(true); } return(false); }
/// <summary> /// Creates a new observable property access proxy /// </summary> /// <param name="modelElement">The model instance element for which to create the property access proxy</param> public PhaseCodeProxy(IElectricalAsset modelElement) : base(modelElement, "phaseCode") { }