public override string ToString()
{
string result = "";
if (r_ == null)
return "null interest rate";
result += string.Format("{0:0.00%}", rate()) + " " + dayCounter().Name + " ";
switch (compounding()) {
case Compounding.Simple:
result += "simple compounding";
break;
case Compounding.Compounded:
switch (frequency()) {
case Frequency.NoFrequency:
case Frequency.Once:
throw new ApplicationException(frequency() + " frequency not allowed for this interest rate");
default:
result += frequency() +" compounding";
break;
}
break;
case Compounding.Continuous:
result += "continuous compounding";
break;
case Compounding.SimpleThenCompounded:
switch (frequency()) {
case Frequency.NoFrequency:
case Frequency.Once:
throw new ApplicationException(frequency() + " frequency not allowed for this interest rate");
default:
result += "simple compounding up to "
+ (int)(12/(int)frequency()) + " months, then "
+ frequency() + " compounding";
break;
}
break;
default:
throw new ApplicationException("unknown compounding convention (" + compounding() + ")");
}
return result;
}