/// <summary>
        /// Gets a dates schedule.
        /// </summary>
        /// <param name="metaScheduleDefinitionRange">This must have 3 columns: interval, interval, roll convention enum.</param>
        /// <param name="startDate"></param>
        /// <param name="businessCalendar"></param>
        /// <param name="calendarAsString"></param>
        /// <param name="businessDayAdjustment"></param>
        /// <returns></returns>
        public static DateTime[] GetMetaDatesSchedule(string[,] metaScheduleDefinitionRange,
                                                      DateTime startDate,
                                                      IBusinessCalendar businessCalendar,
                                                      string calendarAsString,
                                                      string businessDayAdjustment)
        {
            var metaScheduleDefinition = new List <ThreeStringsRangeItem>();
            var index = metaScheduleDefinitionRange.GetLowerBound(1);

            for (var i = metaScheduleDefinitionRange.GetLowerBound(0); i <= metaScheduleDefinitionRange.GetUpperBound(0); i++)
            {
                var output = new ThreeStringsRangeItem
                {
                    Value1 = metaScheduleDefinitionRange[i, index],
                    Value2 = metaScheduleDefinitionRange[i, index + 1],
                    Value3 = metaScheduleDefinitionRange[i, index + 2]
                };
                metaScheduleDefinition.Add(output);
            }
            var result = GetMetaDatesSchedule(metaScheduleDefinition,
                                              startDate,
                                              businessCalendar,
                                              calendarAsString,
                                              businessDayAdjustment);

            return(result);
        }
Esempio n. 2
0
        public void DatesScheduleGeneratorGetDatesScheduleNoAdjustment()
        {
            DateTime startDate = DateTime.Today;

            Debug.Print("Start date: {0}", startDate);

            //BusinessDayAdjustments businessDayAdjustments = BusinessDayAdjustmentsHelper.Create("FOLLOWING", "AUSY-GBLO");
            List <Triplet <Period, Period, RollConventionEnum> > metaScheduleDefinition = GetMetaScheduleDefinition();

            var metaScheduleDefinitionRange = new  List <ThreeStringsRangeItem>();

            foreach (Triplet <Period, Period, RollConventionEnum> triplet in metaScheduleDefinition)
            {
                var threeStringsRangeItem = new ThreeStringsRangeItem
                {
                    Value1 = triplet.First.ToString(),
                    Value2 = triplet.Second.ToString(),
                    Value3 = triplet.Third.ToString()
                };

                metaScheduleDefinitionRange.Add(threeStringsRangeItem);
            }

            object o = DateScheduler.GetUnadjustedDatesSchedule(metaScheduleDefinitionRange, startDate, "");

            //PrintListOfDates(unadjustedDates);
            Debug.Print("Dates:");
            //          Debug.Print(ParameterFormatter.FormatObject(o));
        }