Adjust() public abstract method

Adjusts a Date which falls on a holiday within the indicated Calendar to an appropriate business day.
public abstract Adjust ( Calendar calendar, Date date ) : Date
calendar Calendar The to be used.
date Date The to adjust.
return Date
示例#1
0
        // --------------------------------------------------------------------
        /// <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);
        }