//! utility function giving the inflation period for a given date
public static Pair<Date,Date> inflationPeriod(final Date date,
final Frequency frequency) {
Month month = date.month();
int year = date.year();
Month startMonth, endMonth;
switch (frequency) {
case Annual:
startMonth = Month.January;
endMonth = Month.December;
break;
case Semiannual:
startMonth = Month.valueOf(6*(month.value()-1)/6 + 1);
endMonth = Month.valueOf(startMonth.value() + 5);
break;
case Quarterly:
startMonth = Month.valueOf(3*(month.value()-1)/3 + 1);
endMonth = Month.valueOf(startMonth.value() + 2);
break;
case Monthly:
startMonth = endMonth = month;
break;
default: