#include "cgeneral.h"
#include "cdate.h"
Functions | |
TDateList * | JpmcdsNewEmptyDateList (int numDates) |
Creates a new empty TDateList. | |
int | JpmcdsExtendDateList (TDateList *dateList, int numDates) |
Extends a date list to the given number of dates. | |
TDateList * | JpmcdsNewDateListFromDates (TDate *dates, int numDates) |
Allocates a new TDateList and copies supplied dates into it. | |
void | JpmcdsFreeDateList (TDateList *) |
Frees a DateList. | |
TDateList * | JpmcdsMergeDateLists (TDateList *dateList1, TDateList *dateList2) |
Merges two date lists such that the resultant date list represents the union of the original lists (no duplicates). | |
TDateList * | JpmcdsJpmcdsDateListAddDates (TDateList *dateList, int numDates, TDate *addDates, TBoolean allowDuplicates) |
Adds dates to a date list, and returns a new date list. | |
TDateList * | JpmcdsSubtractDateLists (TDateList *dateList, TDateList *subDates) |
Removes one date list from another date list, and returns a new date list. | |
TDateList * | JpmcdsCopyDateList (TDateList *dl) |
Makes a copy of a date list. | |
TDateList * | JpmcdsSortDateList (TDateList *dl) |
Sorts a datelist. | |
TDateList * | JpmcdsNewDateListDistinct (TDateList *theDateList) |
Takes away the excess same date elements in a DateList. | |
TDateList * | JpmcdsJpmcdsDateListTruncate (TDateList *dateList, TDate truncationDate, TBoolean inclusive, TBoolean excludeBefore, TBoolean inPlace) |
Truncates a date list at the specified date. |
Makes a copy of a date list.
Returns NULL on error, or if the original datelist was NULL.
int JpmcdsExtendDateList | ( | TDateList * | dateList, | |
int | numDates | |||
) |
Extends a date list to the given number of dates.
This involves re-allocating the array within the TDateList structure.
Requesting a smaller number of dates returns FAILURE and leaves the dateList unchanged.
TDateList* JpmcdsJpmcdsDateListAddDates | ( | TDateList * | dateList, | |
int | numDates, | |||
TDate * | addDates, | |||
TBoolean | allowDuplicates | |||
) |
Adds dates to a date list, and returns a new date list.
Both the list of dates and the date list must be sorted. Keeps duplicates dates depending on the allowDuplicate flag (FALSE = remove duplicates, TRUE = keep them).
TDateList* JpmcdsJpmcdsDateListTruncate | ( | TDateList * | dateList, | |
TDate | truncationDate, | |||
TBoolean | inclusive, | |||
TBoolean | excludeBefore, | |||
TBoolean | inPlace | |||
) |
Truncates a date list at the specified date.
The resulting date list will contain all dates previous to (or following) the specified date. Dates in the datelist which match the specified date may be optionally included. The datelist may optionally be modified in place or a new copy is returned.
The input date list must be sorted.
Merges two date lists such that the resultant date list represents the union of the original lists (no duplicates).
Resultant list will be in sorted order.
Note:
1. Both input lists must be in sorted order
2. Each original date list must not contain duplicates
3. If either of the datelists is NULL, it just makes a copy of the other and returns it. If both are NULL, it returns NULL.
Takes away the excess same date elements in a DateList.
Especially, useful to clean up a DateList after going through bad-day adj.
TDateList* JpmcdsNewEmptyDateList | ( | int | numDates | ) |
Sorts a datelist.
Returns NULL on FAILURE, and the sorted DateList on success.
Removes one date list from another date list, and returns a new date list.
The input date lists may be unsorted. Output date list is sorted. Note the algorithm used may be inefficient if subDates is large.