Removed check for periodLengh (simplifies code).
The impact should be small. In the rare case that periodLength == 0
there is an unecessary call to getDiscountFactor.
@@ -76,8 +76,6 @@ public class SwapLeg extends AbstractAnalyticProduct implements AnalyticProductI
double paymentDate = legSchedule.getPayment(periodIndex);
double periodLength = legSchedule.getPeriodLength(periodIndex);
- // Consider coupon payment if periodLength is non-zero
- if(periodLength != 0) {
double forward = spread;
if(forwardCurve != null) {
forward += forwardCurve.getForward(model, fixingDate, paymentDate-fixingDate);
@@ -85,7 +83,6 @@ public class SwapLeg extends AbstractAnalyticProduct implements AnalyticProductI
double discountFactor = paymentDate > evaluationTime ? discountCurve.getDiscountFactor(model, paymentDate) : 0.0;
value += forward * periodLength * discountFactor;
- }
// Consider notional payments if required
if(isNotionalExchanged) {
