public static void Example4() { DateTime startDate = new Date(2009, 8, 3).DateValue; DateTime endDate = new Date(2014, 10, 3).DateValue; // Now test with bool as well bool adjusted = true; int paymentPerYear = 2; bool arrears = false; int fixingDays = -2; bool shortPeriod = true; DateSchedule myDL_1 = new DateSchedule(startDate, endDate, paymentPerYear, shortPeriod, adjusted, arrears, fixingDays); Console.WriteLine("Marix<Date> GetLongScheduleDate()"); myDL_1.PrintDateMatrix(myDL_1.GetLongScheduleDate()); Console.WriteLine(); Console.WriteLine("Matrix<double> GetLongScheduleSerial()"); myDL_1.GetLongScheduleSerial().extendedPrint(); Console.WriteLine(); Console.WriteLine("Marix<Date> GetShortScheduleDate()"); myDL_1.PrintDateMatrix(myDL_1.GetShortScheduleDate()); Console.WriteLine(); Console.WriteLine("Array<Date>PaymentDateArray()"); myDL_1.PrintDateArray(myDL_1.PaymentDateArray()); Console.WriteLine(); Console.WriteLine("count numbers of rows: public int Length " + myDL_1.Length); }
public static void Example5() { // 1. Create the date schedule data DateTime startDate = new Date(2009, 8, 3).DateValue; DateTime endDate = new Date(2014, 10, 3).DateValue; bool adjusted = true; int paymentPerYear = 2; bool arrears = false; int fixingDays = -2; bool shortPeriod = true; // 2. My date scheduled. DateSchedule myDL_1 = new DateSchedule(startDate, endDate, paymentPerYear, shortPeriod, adjusted, arrears, fixingDays); // 3. Init a NumericMatrix<double> Class from my dates. NumericMatrix <double> myDates = (NumericMatrix <double>) myDL_1.GetLongScheduleSerial(); // 4. Create an associative matrix AssocMatrix with "header" label // for columns and "n_lines" for rows 4A. Label for columns. Set <string> header = new Set <string>(); header.Insert("FixingDate"); header.Insert("StartDate"); header.Insert("EndDate"); header.Insert("PaymentDate"); // 4B. Label for rows Set <string> n_line = new Set <string>(); for (int i = 0; i < myDates.MaxRowIndex + 1; i++) { n_line.Insert("# " + (i + 1)); } // 5. Creating AssocMatrix. AssocMatrix <string, string, double> OutMatrix = new AssocMatrix <string, string, double>(n_line, header, myDates); // 6. Print associative matrices in Excel, to "My Date // List" sheet, the output in Excel serial number format. ExcelMechanisms exl = new ExcelMechanisms(); exl.printAssocMatrixInExcel <string, string, double> (OutMatrix, "My Date List"); }