/// <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; } } }
public void ReleaseBay(IVehicle vehicle) { IBay assignedBay = m_Bays.FirstOrDefault(x => x.Vehicle == vehicle); if (assignedBay == null) { throw new NoVehicleFoundInBaysException(vehicle); } assignedBay.Vehicle = null; }
public void AssignBay(IVehicle vehicle) { IBay emptyBay = m_Bays.FirstOrDefault(x => x.IsEmpty); if (emptyBay == null) { throw new NoEmptyBayException(vehicle); } emptyBay.Vehicle = vehicle; }
public int FindVehicleBayId(IVehicle vehicle) { IBay assignedBay = m_Bays.FirstOrDefault(x => x.Vehicle == vehicle); if (assignedBay == null) { throw new NoVehicleFoundInBaysException(vehicle); } return(assignedBay.Id); }
/// <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); }
/// <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); }
/// <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); } }
/// <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") { }
/// <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") { }
public void Release(IBay bay) { }