lastDate = cashflows.get(i - 1).date().clone();
} else {
final Object cpnObj = cashflows.get(i);
final Coupon coupon = Coupon.class.isAssignableFrom(cpnObj.getClass()) ? (Coupon)cpnObj : null;
if (coupon != null) {
lastDate = coupon.accrualStartDate().clone();
} else {
lastDate = couponDate.sub(new Period(1, TimeUnit.Years));
}
}
discount *= y.discountFactor(settlement, couponDate, lastDate, couponDate);