Exemplo n.º 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)
            {
                IPowerSystemResource powerSystemResourceItem = item.As <IPowerSystemResource>();

                if (((powerSystemResourceItem != null) &&
                     this._parent.PowerSystemResource.Remove(powerSystemResourceItem)))
                {
                    return(true);
                }
                IBusNameMarker busNameMarkerItem = item.As <IBusNameMarker>();

                if (((busNameMarkerItem != null) &&
                     this._parent.BusNameMarker.Remove(busNameMarkerItem)))
                {
                    return(true);
                }
                ITopologicalNode topologicalNodeItem = item.As <ITopologicalNode>();

                if (((topologicalNodeItem != null) &&
                     this._parent.TopologicalNode.Remove(topologicalNodeItem)))
                {
                    return(true);
                }
                if ((this._parent.ReportingSuperGroup == item))
                {
                    this._parent.ReportingSuperGroup = null;
                    return(true);
                }
                return(false);
            }
Exemplo n.º 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)
            {
                IPowerSystemResource powerSystemResourceCasted = item.As <IPowerSystemResource>();

                if ((powerSystemResourceCasted != null))
                {
                    this._parent.PowerSystemResource.Add(powerSystemResourceCasted);
                }
                IBusNameMarker busNameMarkerCasted = item.As <IBusNameMarker>();

                if ((busNameMarkerCasted != null))
                {
                    this._parent.BusNameMarker.Add(busNameMarkerCasted);
                }
                ITopologicalNode topologicalNodeCasted = item.As <ITopologicalNode>();

                if ((topologicalNodeCasted != null))
                {
                    this._parent.TopologicalNode.Add(topologicalNodeCasted);
                }
                if ((this._parent.ReportingSuperGroup == null))
                {
                    IReportingSuperGroup reportingSuperGroupCasted = item.As <IReportingSuperGroup>();
                    if ((reportingSuperGroupCasted != null))
                    {
                        this._parent.ReportingSuperGroup = reportingSuperGroupCasted;
                        return;
                    }
                }
            }
Exemplo n.º 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)
            {
                if ((this._parent.ConnectivityNodeContainer == null))
                {
                    IConnectivityNodeContainer connectivityNodeContainerCasted = item.As <IConnectivityNodeContainer>();
                    if ((connectivityNodeContainerCasted != null))
                    {
                        this._parent.ConnectivityNodeContainer = connectivityNodeContainerCasted;
                        return;
                    }
                }
                if ((this._parent.TopologicalNode == null))
                {
                    ITopologicalNode topologicalNodeCasted = item.As <ITopologicalNode>();
                    if ((topologicalNodeCasted != null))
                    {
                        this._parent.TopologicalNode = topologicalNodeCasted;
                        return;
                    }
                }
                if ((this._parent.BusNameMarker == null))
                {
                    IBusNameMarker busNameMarkerCasted = item.As <IBusNameMarker>();
                    if ((busNameMarkerCasted != null))
                    {
                        this._parent.BusNameMarker = busNameMarkerCasted;
                        return;
                    }
                }
                ILossPenaltyFactor lossPenaltyFactorsCasted = item.As <ILossPenaltyFactor>();

                if ((lossPenaltyFactorsCasted != null))
                {
                    this._parent.LossPenaltyFactors.Add(lossPenaltyFactorsCasted);
                }
                INodeConstraintTerm nodeConstraintTermsCasted = item.As <INodeConstraintTerm>();

                if ((nodeConstraintTermsCasted != null))
                {
                    this._parent.NodeConstraintTerms.Add(nodeConstraintTermsCasted);
                }
                ITerminal terminalsCasted = item.As <ITerminal>();

                if ((terminalsCasted != null))
                {
                    this._parent.Terminals.Add(terminalsCasted);
                }
                if ((this._parent.Pnode == null))
                {
                    IPnode pnodeCasted = item.As <IPnode>();
                    if ((pnodeCasted != null))
                    {
                        this._parent.Pnode = pnodeCasted;
                        return;
                    }
                }
            }