DDay.iCal.TimeZoneEvaluator.ProcessOccurrences C# (CSharp) Метод

ProcessOccurrences() приватный Метод

private ProcessOccurrences ( IDateTime referenceDate ) : void
referenceDate IDateTime
Результат void
        void ProcessOccurrences(IDateTime referenceDate)
        {
            // Sort the occurrences by start time
            m_Occurrences.Sort(
                delegate(Occurrence o1, Occurrence o2)
                {
                    if (o1.Period == null || o1.Period.StartTime == null)
                        return -1;
                    else if (o2.Period == null || o2.Period.StartTime == null)
                        return 1;
                    else return o1.Period.StartTime.CompareTo(o2.Period.StartTime);
                }
            );

            for (int i = 0; i < m_Occurrences.Count; i++)
            {
                Occurrence curr = m_Occurrences[i];
                Occurrence? next = i < m_Occurrences.Count - 1 ? (Occurrence?)m_Occurrences[i + 1] : null;

                // Determine end times for our periods, overwriting previously calculated end times.
                // This is important because we don't want to overcalculate our time zone information,
                // but simply calculate enough to be accurate.  When date/time ranges that are out of
                // normal working bounds are encountered, then occurrences are processed again, and
                // new end times are determined.
                if (next != null && next.HasValue)
                {
                    curr.Period.EndTime = next.Value.Period.StartTime.AddTicks(-1);
                }
                else
                {
                    curr.Period.EndTime = ConvertToIDateTime(EvaluationEndBounds, referenceDate);
                }
            }
        }