public abstract Adjust ( |
||
calendar | The |
|
date | Date | The |
return | Date |
// -------------------------------------------------------------------- /// <summary> /// Generates a set of dates according to schedule defined by a start date, /// an end date, an interval, roll convention and a calendar. /// </summary> /// <param name="start">The start date.</param> /// <param name="end">The end date.</param> /// <param name="frequency">The frequency of the schedule (e.g. 6M).</param> /// <param name="roll">The date roll convention or <c>null</c>.</param> /// <param name="calendar">The holiday calendar or <c>null</c>.</param> /// <returns>An array of calculated and adjusted dates.</returns> private static Date[] GenerateSchedule(Date start, Date end, Interval frequency, DateRoll roll, Calendar calendar) { Date current = start; ArrayList found = new ArrayList (); Date [] dates; while (Less (current, end)) { Date adjusted; if (roll != null) adjusted = roll.Adjust (calendar, current); else adjusted = current; if (!found.Contains (adjusted)) found.Add (adjusted); if (frequency.Period == Period.TERM) { if (Equal (current, start)) current = end; else break; } else current = current.Plus (frequency); } found.CopyTo (dates = new Date [found.Count]); return (dates); }