/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { IAnalog measurementsCasted = item.As <IAnalog>(); if ((measurementsCasted != null)) { this._parent.Measurements.Add(measurementsCasted); } IAnalogLimit limitsCasted = item.As <IAnalogLimit>(); if ((limitsCasted != null)) { this._parent.Limits.Add(limitsCasted); } }
/// <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) { IAnalog analogItem = item.As <IAnalog>(); if (((analogItem != null) && this._parent.Measurements.Remove(analogItem))) { return(true); } IAnalogLimit analogLimitItem = item.As <IAnalogLimit>(); if (((analogLimitItem != null) && this._parent.Limits.Remove(analogLimitItem))) { return(true); } return(false); }