/// <summary>
        /// The Format
        /// </summary>
        /// <param name="field">The field<see cref="CrontabField"/></param>
        /// <param name="writer">The writer<see cref="TextWriter"/></param>
        /// <param name="noNames">The noNames<see cref="bool"/></param>
        public void Format(CrontabField field, TextWriter writer, bool noNames)
        {
            if (field == null)
            {
                throw new ArgumentNullException(nameof(field));
            }

            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            var next  = field.GetFirst();
            var count = 0;

            while (next != -1)
            {
                var first = next;
                int last;

                do
                {
                    last = next;
                    next = field.Next(last + 1);
                } while (next - last == 1);

                if (count == 0 &&
                    first == _minValue && last == _maxValue)
                {
                    writer.Write('*');
                    return;
                }

                if (count > 0)
                {
                    writer.Write(',');
                }

                if (first == last)
                {
                    FormatValue(first, writer, noNames);
                }
                else
                {
                    FormatValue(first, writer, noNames);
                    writer.Write('-');
                    FormatValue(last, writer, noNames);
                }

                count++;
            }
        }
        /// <summary>
        /// Prevents a default instance of the <see cref="CrontabSchedule"/> class from being created.
        /// </summary>
        /// <param name="expression">The expression<see cref="string"/></param>
        private CrontabSchedule(string expression)
        {
            Debug.Assert(expression != null);

            var fields = expression.Split((char[])Separators, StringSplitOptions.RemoveEmptyEntries);

            if (fields.Length != 5)
            {
                throw new FormatException(string.Format(
                                              "'{0}' is not a valid crontab expression. It must contain at least 5 components of a schedule "
                                              + "(in the sequence of minutes, hours, days, months, days of week).",
                                              expression));
            }

            _minutes    = CrontabField.Minutes(fields[0]);
            _hours      = CrontabField.Hours(fields[1]);
            _days       = CrontabField.Days(fields[2]);
            _months     = CrontabField.Months(fields[3]);
            _daysOfWeek = CrontabField.DaysOfWeek(fields[4]);
        }