Exemple #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)
            {
                IEnergyProfile energyProfilesCasted = item.As <IEnergyProfile>();

                if ((energyProfilesCasted != null))
                {
                    this._parent.EnergyProfiles.Add(energyProfilesCasted);
                }
                if ((this._parent.Delivery_Pnode == null))
                {
                    IPnode delivery_PnodeCasted = item.As <IPnode>();
                    if ((delivery_PnodeCasted != null))
                    {
                        this._parent.Delivery_Pnode = delivery_PnodeCasted;
                        return;
                    }
                }
                if ((this._parent.Receipt_Pnode == null))
                {
                    IPnode receipt_PnodeCasted = item.As <IPnode>();
                    if ((receipt_PnodeCasted != null))
                    {
                        this._parent.Receipt_Pnode = receipt_PnodeCasted;
                        return;
                    }
                }
            }
Exemple #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)
            {
                IEnergyProfile energyProfileItem = item.As <IEnergyProfile>();

                if (((energyProfileItem != null) &&
                     this._parent.EnergyProfiles.Remove(energyProfileItem)))
                {
                    return(true);
                }
                if ((this._parent.Delivery_Pnode == item))
                {
                    this._parent.Delivery_Pnode = null;
                    return(true);
                }
                if ((this._parent.Receipt_Pnode == item))
                {
                    this._parent.Receipt_Pnode = null;
                    return(true);
                }
                return(false);
            }