CapFloorInflationYearOnYearInterpolationDefinition extends CouponInflationDefinition implements CapFloor { public static CapFloorInflationYearOnYearInterpolationDefinition from(final ZonedDateTime accrualStartDate, final ZonedDateTime paymentDate, final double notional, final IndexPrice priceIndex, final ZonedDateTime lastKnownFixingDate, final int conventionalMonthLag, final int monthLag, final ZonedDateTime[] referenceStartDate, final ZonedDateTime[] referenceEndDate, final double strike, final boolean isCap) { Validate.notNull(priceIndex, "Price index"); final double weightStart; final double weightEnd; weightStart = 1.0 - (paymentDate.getDayOfMonth() - 1.0) / paymentDate.toLocalDate().lengthOfMonth(); weightEnd = weightStart; return new CapFloorInflationYearOnYearInterpolationDefinition(priceIndex.getCurrency(), paymentDate, accrualStartDate, paymentDate, 1.0, notional, priceIndex, lastKnownFixingDate, conventionalMonthLag, monthLag, referenceStartDate, referenceEndDate, weightStart, weightEnd, strike, isCap); } CapFloorInflationYearOnYearInterpolationDefinition(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 ZonedDateTime[] referenceStartDate, final ZonedDateTime[] referenceEndDate, final double weightStart,
      final double weightEnd, final double strike, final boolean isCap); static CapFloorInflationYearOnYearInterpolationDefinition from(final ZonedDateTime accrualStartDate, final ZonedDateTime paymentDate, final double notional,
      final IndexPrice priceIndex, final ZonedDateTime lastKnownFixingDate, final int conventionalMonthLag, final int monthLag, final ZonedDateTime[] referenceStartDate,
      final ZonedDateTime[] referenceEndDate, final double strike, final boolean isCap); static CapFloorInflationYearOnYearInterpolationDefinition from(final ZonedDateTime accrualStartDate, final ZonedDateTime paymentDate, final double notional,
      final IndexPrice priceIndex, final ZonedDateTime lastKnownFixingDate, final int conventionalMonthLag, final ZonedDateTime[] referenceStartDate, final ZonedDateTime[] referenceEndDate,
      final double strike, final boolean isCap); static CapFloorInflationYearOnYearInterpolationDefinition from(final CouponInflationYearOnYearInterpolationDefinition coupon, final ZonedDateTime lastKnownFixingDate,
      final double strike, final boolean isCap); static CapFloorInflationYearOnYearInterpolationDefinition from(final ZonedDateTime accrualStartDate, final ZonedDateTime paymentDate, final double notional,
      final IndexPrice priceIndex, final ZonedDateTime lastKnownFixingDate, final int conventionalMonthLag, final int monthLag, final double weightStart, final double weightEnd,
      final double strike, final boolean isCap); static CapFloorInflationYearOnYearInterpolationDefinition from(final ZonedDateTime accrualStartDate, final ZonedDateTime paymentDate, final double notional,
      final IndexPrice priceIndex, final int conventionalmonthLag, final int monthLag, final ZonedDateTime lastKnownFixingDate, final double strike, final boolean isCap); ZonedDateTime getLastKnownFixingDate(); int getConventionalMonthLag(); int getMonthLag(); ZonedDateTime[] getReferenceStartDate(); ZonedDateTime[] getReferenceEndDate(); double getWeightStart(); double getWeightEnd(); @Override double getStrike(); @Override boolean isCap(); @Override double payOff(final double fixing); @Override CouponInflationDefinition with(final ZonedDateTime paymentDate, final ZonedDateTime accrualStartDate, final ZonedDateTime accrualEndDate, final double notional); @Override CapFloorInflationYearOnYearInterpolation toDerivative(final ZonedDateTime date); @Override Coupon toDerivative(final ZonedDateTime date, final DoubleTimeSeries<ZonedDateTime> priceIndexTimeSeries); @Override V accept(final InstrumentDefinitionVisitor<U, V> visitor, final U data); @Override V accept(final InstrumentDefinitionVisitor<?, V> visitor); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void from() { final CapFloorInflationYearOnYearInterpolationDefinition constructor = new CapFloorInflationYearOnYearInterpolationDefinition(CUR, PAYMENT_DATE, ACCRUAL_START_DATE, ACCRUAL_END_DATE, 1.0, NOTIONAL, PRICE_INDEX, LAST_KNOWN_FIXING_DATE, MONTH_LAG, 3, REFERENCE_START_DATE, REFERENCE_END_DATE, WEIGHT_START, WEIGHT_END, STRIKE, IS_CAP); final CouponInflationYearOnYearInterpolationDefinition yoyCoupon = new CouponInflationYearOnYearInterpolationDefinition(CUR, PAYMENT_DATE, ACCRUAL_START_DATE, ACCRUAL_END_DATE, 1.0, NOTIONAL, PRICE_INDEX, MONTH_LAG, 3, REFERENCE_START_DATE, REFERENCE_END_DATE, false, WEIGHT_START, WEIGHT_END); final CapFloorInflationYearOnYearInterpolationDefinition from = CapFloorInflationYearOnYearInterpolationDefinition.from(yoyCoupon, LAST_KNOWN_FIXING_DATE, STRIKE, IS_CAP); assertEquals("Inflation zero-coupon : from", constructor, from); }