class CapFloorInflationZeroCouponInterpolationDefinition extends CouponInflationDefinition implements CapFloor {

  public static CapFloorInflationZeroCouponInterpolationDefinition from(final ZonedDateTime accrualStartDate, final ZonedDateTime paymentDate, final double notional,
      final IndexPrice priceIndex, final int conventionalMonthLag, final int monthlag, final int maturity, final ZonedDateTime lastKnownFixingDate, final ZonedDateTime[] referenceEndDate,
      final double strike, final boolean isCap) {
    Validate.notNull(priceIndex, "Price index");
    final double weight = 1.0 - (paymentDate.getDayOfMonth() - 1.0) / paymentDate.toLocalDate().lengthOfMonth();
    final ZonedDateTime[] referenceStartDates = new ZonedDateTime[2];
    referenceStartDates[0] = accrualStartDate.minusMonths(monthlag).with(TemporalAdjusters.lastDayOfMonth());
    referenceStartDates[1] = referenceStartDates[0].plusMonths(1).with(TemporalAdjusters.lastDayOfMonth());
    return new CapFloorInflationZeroCouponInterpolationDefinition(priceIndex.getCurrency(), paymentDate, accrualStartDate, paymentDate, 1.0,
        notional, priceIndex, lastKnownFixingDate, conventionalMonthLag, monthlag, maturity, referenceStartDates, referenceEndDate, weight, strike, isCap);
  }

  public  CapFloorInflationZeroCouponInterpolationDefinition(final Currency currency, final ZonedDateTime paymentDate, final ZonedDateTime accrualStartDate,
      final ZonedDateTime accrualEndDate, final double paymentYearFraction, final double notional, final IndexPrice priceIndex, final ZonedDateTime lastKnownFixingDate,
      final int conventionalMonthLag, final int monthLag, final int maturity, final ZonedDateTime[] referenceStartDates, final ZonedDateTime[] referenceEndDates, final double weight,
      final double strike, final boolean isCap);

}