Exemplo n.º 1
0
        /// <summary>
        /// Turn off traffic light connected to power station
        /// </summary>
        /// <param name="id">Id of traffic light</param>
        public void PowerOffTrafficLightById(int id)
        {
            ITrafficLight tl = TrafficLights.Find(x => x.Id == id);

            if (tl != null)
            {
                tl.PowerOff();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Remove traffic light from list by id
        /// </summary>
        /// <param name="id">Id of traffic light</param>
        public void RemoveTrafficLightById(int id)
        {
            ITrafficLight tl = TrafficLights.Find(x => x.Id == id);

            if (tl != null)
            {
                tl.PowerOff();
                TrafficLights.Remove(tl);
                CurrentPowerLevel = CurrentPowerLevel + tl.PowerConsumption;
            }
        }