예제 #1
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)
            {
                IOpenCircuitTest openCircuitTestItem = item.As <IOpenCircuitTest>();

                if (((openCircuitTestItem != null) &&
                     this._parent.OpenCircuitTests.Remove(openCircuitTestItem)))
                {
                    return(true);
                }
                if ((this._parent.ToWinding == item))
                {
                    this._parent.ToWinding = null;
                    return(true);
                }
                IShortCircuitTest shortCircuitTestItem = item.As <IShortCircuitTest>();

                if (((shortCircuitTestItem != null) &&
                     this._parent.ShortCircuitTests.Remove(shortCircuitTestItem)))
                {
                    return(true);
                }
                return(false);
            }
예제 #2
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                IOpenCircuitTest openCircuitTestsCasted = item.As <IOpenCircuitTest>();

                if ((openCircuitTestsCasted != null))
                {
                    this._parent.OpenCircuitTests.Add(openCircuitTestsCasted);
                }
                if ((this._parent.ToWinding == null))
                {
                    IWindingInfo toWindingCasted = item.As <IWindingInfo>();
                    if ((toWindingCasted != null))
                    {
                        this._parent.ToWinding = toWindingCasted;
                        return;
                    }
                }
                IShortCircuitTest shortCircuitTestsCasted = item.As <IShortCircuitTest>();

                if ((shortCircuitTestsCasted != null))
                {
                    this._parent.ShortCircuitTests.Add(shortCircuitTestsCasted);
                }
            }