コード例 #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)
            {
                IBay baysCasted = item.As <IBay>();

                if ((baysCasted != null))
                {
                    this._parent.Bays.Add(baysCasted);
                }
                if ((this._parent.BaseVoltage == null))
                {
                    IBaseVoltage baseVoltageCasted = item.As <IBaseVoltage>();
                    if ((baseVoltageCasted != null))
                    {
                        this._parent.BaseVoltage = baseVoltageCasted;
                        return;
                    }
                }
                if ((this._parent.Substation == null))
                {
                    ISubstation substationCasted = item.As <ISubstation>();
                    if ((substationCasted != null))
                    {
                        this._parent.Substation = substationCasted;
                        return;
                    }
                }
            }
コード例 #2
0
        public void ReleaseBay(IVehicle vehicle)
        {
            IBay assignedBay = m_Bays.FirstOrDefault(x => x.Vehicle == vehicle);

            if (assignedBay == null)
            {
                throw new NoVehicleFoundInBaysException(vehicle);
            }

            assignedBay.Vehicle = null;
        }
コード例 #3
0
        public void AssignBay(IVehicle vehicle)
        {
            IBay emptyBay = m_Bays.FirstOrDefault(x => x.IsEmpty);

            if (emptyBay == null)
            {
                throw new NoEmptyBayException(vehicle);
            }

            emptyBay.Vehicle = vehicle;
        }
コード例 #4
0
        public int FindVehicleBayId(IVehicle vehicle)
        {
            IBay assignedBay = m_Bays.FirstOrDefault(x => x.Vehicle == vehicle);

            if (assignedBay == null)
            {
                throw new NoVehicleFoundInBaysException(vehicle);
            }

            return(assignedBay.Id);
        }
コード例 #5
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)
            {
                IBay bayItem = item.As <IBay>();

                if (((bayItem != null) &&
                     this._parent.Bays.Remove(bayItem)))
                {
                    return(true);
                }
                if ((this._parent.BaseVoltage == item))
                {
                    this._parent.BaseVoltage = null;
                    return(true);
                }
                if ((this._parent.Substation == item))
                {
                    this._parent.Substation = null;
                    return(true);
                }
                return(false);
            }
コード例 #6
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)
            {
                IBay bayItem = item.As <IBay>();

                if (((bayItem != null) &&
                     this._parent.Bays.Remove(bayItem)))
                {
                    return(true);
                }
                if ((this._parent.Region == item))
                {
                    this._parent.Region = null;
                    return(true);
                }
                IVoltageLevel voltageLevelItem = item.As <IVoltageLevel>();

                if (((voltageLevelItem != null) &&
                     this._parent.VoltageLevels.Remove(voltageLevelItem)))
                {
                    return(true);
                }
                return(false);
            }
コード例 #7
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                IBay baysCasted = item.As <IBay>();

                if ((baysCasted != null))
                {
                    this._parent.Bays.Add(baysCasted);
                }
                if ((this._parent.Region == null))
                {
                    ISubGeographicalRegion regionCasted = item.As <ISubGeographicalRegion>();
                    if ((regionCasted != null))
                    {
                        this._parent.Region = regionCasted;
                        return;
                    }
                }
                IVoltageLevel voltageLevelsCasted = item.As <IVoltageLevel>();

                if ((voltageLevelsCasted != null))
                {
                    this._parent.VoltageLevels.Add(voltageLevelsCasted);
                }
            }
コード例 #8
0
 /// <summary>
 /// Creates a new observable property access proxy
 /// </summary>
 /// <param name="modelElement">The model instance element for which to create the property access proxy</param>
 public BreakerConfigurationProxy(IBay modelElement) :
     base(modelElement, "breakerConfiguration")
 {
 }
コード例 #9
0
 /// <summary>
 /// Creates a new observable property access proxy
 /// </summary>
 /// <param name="modelElement">The model instance element for which to create the property access proxy</param>
 public BusBarConfigurationProxy(IBay modelElement) :
     base(modelElement, "busBarConfiguration")
 {
 }
コード例 #10
0
 public void Release(IBay bay)
 {
 }