Beispiel #1
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                IAccumulator measurementsCasted = item.As <IAccumulator>();

                if ((measurementsCasted != null))
                {
                    this._parent.Measurements.Add(measurementsCasted);
                }
                IAccumulatorLimit limitsCasted = item.As <IAccumulatorLimit>();

                if ((limitsCasted != null))
                {
                    this._parent.Limits.Add(limitsCasted);
                }
            }
Beispiel #2
0
            /// <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)
            {
                IAccumulator accumulatorItem = item.As <IAccumulator>();

                if (((accumulatorItem != null) &&
                     this._parent.Measurements.Remove(accumulatorItem)))
                {
                    return(true);
                }
                IAccumulatorLimit accumulatorLimitItem = item.As <IAccumulatorLimit>();

                if (((accumulatorLimitItem != null) &&
                     this._parent.Limits.Remove(accumulatorLimitItem)))
                {
                    return(true);
                }
                return(false);
            }