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)
 {
     if ((this._parent.RatioVariationCurve == null))
     {
         IRatioVariationCurve ratioVariationCurveCasted = item.As <IRatioVariationCurve>();
         if ((ratioVariationCurveCasted != null))
         {
             this._parent.RatioVariationCurve = ratioVariationCurveCasted;
             return;
         }
     }
     if ((this._parent.TransformerWinding == null))
     {
         ITransformerWinding transformerWindingCasted = item.As <ITransformerWinding>();
         if ((transformerWindingCasted != null))
         {
             this._parent.TransformerWinding = transformerWindingCasted;
             return;
         }
     }
     if ((this._parent.Winding == null))
     {
         IDistributionTransformerWinding windingCasted = item.As <IDistributionTransformerWinding>();
         if ((windingCasted != null))
         {
             this._parent.Winding = windingCasted;
             return;
         }
     }
 }
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)
            {
                IFlowgate flowgateItem = item.As <IFlowgate>();

                if (((flowgateItem != null) &&
                     this._parent.Flowgates.Remove(flowgateItem)))
                {
                    return(true);
                }
                if ((this._parent.HeatExchanger == item))
                {
                    this._parent.HeatExchanger = null;
                    return(true);
                }
                ITransformerWinding transformerWindingItem = item.As <ITransformerWinding>();

                if (((transformerWindingItem != null) &&
                     this._parent.TransformerWindings.Remove(transformerWindingItem)))
                {
                    return(true);
                }
                return(false);
            }
Beispiel #3
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                IFlowgate flowgatesCasted = item.As <IFlowgate>();

                if ((flowgatesCasted != null))
                {
                    this._parent.Flowgates.Add(flowgatesCasted);
                }
                if ((this._parent.HeatExchanger == null))
                {
                    IHeatExchanger heatExchangerCasted = item.As <IHeatExchanger>();
                    if ((heatExchangerCasted != null))
                    {
                        this._parent.HeatExchanger = heatExchangerCasted;
                        return;
                    }
                }
                ITransformerWinding transformerWindingsCasted = item.As <ITransformerWinding>();

                if ((transformerWindingsCasted != null))
                {
                    this._parent.TransformerWindings.Add(transformerWindingsCasted);
                }
            }