/// <summary>
        /// Adds "second" changing lamp sign to string builder.
        /// </summary>
        public void addSecondChangeLampRow(DateTime24 time, StringBuilder s)
        {
            bool isOn = IsLampOn(LampType.SecondChange, 1, time);
            LampColor color = GetLampOnColor(LampType.SecondChange, 1);

            addLamp(isOn, color, s);

            s.AppendLine();
        }
        /// <summary>
        /// Parses atomic time into three output parameters: hour, minute, second.
        /// DateTime struct cannot be used, since hour is greater than 23 and not supported.
        /// </summary>
        public static bool tryParseExactATime(string aTime, out DateTime24 time)
        {
            time.Hour = time.Minute = time.Second = 0;

            string[] partTimes = aTime.Split(':');

            return partTimes.Length == 3 && partTimes[0].Length == 2 && partTimes[1].Length == 2 && partTimes[2].Length == 2
                && int.TryParse(partTimes[0], out time.Hour) && time.Hour >= 0 && time.Hour <= 24
                && int.TryParse(partTimes[1], out time.Minute) && time.Minute >= 0 && time.Minute < 60
                && int.TryParse(partTimes[2], out time.Second) && time.Second >= 0 && time.Second < 60
                ;
        }
        /// <summary>
        /// Adds 5 minute group signs to string builder.
        /// </summary>
        private void addGroupedMinuteLampRow(DateTime24 time, StringBuilder s)
        {
            for (int i = 1; i <= 11; i++)
            {
                bool isOn = IsLampOn(LampType.GroupedMinute, i, time);
                LampColor color = GetLampOnColor(LampType.GroupedMinute, i);

                addLamp(isOn, color, s);
            }

            s.AppendLine();
        }
        /// <summary>
        /// Adds remaining hour signs, that don't fit into hour groups, to string builder.
        /// </summary>
        private void addLeftHourLampRow(DateTime24 time, StringBuilder s)
        {
            for (int i = 1; i <= 4; i++)
            {
                bool isOn = IsLampOn(LampType.LeftHour, i, time);
                LampColor color = GetLampOnColor(LampType.LeftHour, i);

                addLamp(isOn, color, s);
            }

            s.AppendLine();
        }
 /// <summary>
 /// At any moment of time, determines if the lamp, defined by the type and its position, is on.
 /// </summary>
 private bool IsLampOn(LampType type, int lampNo, DateTime24 time)
 {
     switch (type)
     {
         case LampType.SecondChange:
             return time.Second % 2 == 0;
         case LampType.GroupedHour:
             return time.Hour / 5 >= lampNo;
         case LampType.LeftHour:
             return time.Hour % 5 >= lampNo;
         case LampType.GroupedMinute:
             return time.Minute / 5 >= lampNo;
         case LampType.LeftMinute:
             return time.Minute % 5 >= lampNo;
         default:
             throw new Exception("On functionality not implemented for lamp of type " + type);
     }
 }