final FloatingInterestRateLeg floatReceiveLeg = (FloatingInterestRateLeg) receiveLeg;
final ExternalId regionId = payLeg.getRegionId();
final Calendar calendar = CalendarUtils.getCalendar(_regionSource, _holidaySource, regionId);
final Currency currency = ((InterestRateNotional) payLeg.getNotional()).getCurrency();
if (floatPayLeg instanceof FloatingSpreadIRLeg) {
final AnnuityCouponIborSpreadDefinition payLegDefinition = getIborSwapLegDefinition(effectiveDate, maturityDate, (FloatingSpreadIRLeg) floatPayLeg, calendar, currency, true);
if (floatReceiveLeg instanceof FloatingSpreadIRLeg) {
final AnnuityCouponIborSpreadDefinition receiveLegDefinition = getIborSwapLegDefinition(effectiveDate, maturityDate, (FloatingSpreadIRLeg) floatReceiveLeg, calendar, currency, false);
return SwapIborIborDefinition.from(payLegDefinition, receiveLegDefinition);
}
final AnnuityCouponIborDefinition receiveLegDefinition = getIborSwapLegDefinition(effectiveDate, maturityDate, floatReceiveLeg, calendar, currency, false);
return SwapIborIborDefinition.from(payLegDefinition, receiveLegDefinition);
}
final AnnuityCouponIborDefinition payLegDefinition = getIborSwapLegDefinition(effectiveDate, maturityDate, floatPayLeg, calendar, currency, true);
if (floatReceiveLeg instanceof FloatingSpreadIRLeg) {
final AnnuityCouponIborSpreadDefinition receiveLegDefinition = getIborSwapLegDefinition(effectiveDate, maturityDate, (FloatingSpreadIRLeg) floatReceiveLeg, calendar, currency, false);
return SwapIborIborDefinition.from(payLegDefinition, receiveLegDefinition);
}
final AnnuityCouponIborDefinition receiveLegDefinition = getIborSwapLegDefinition(effectiveDate, maturityDate, floatReceiveLeg, calendar, currency, false);
return SwapIborIborDefinition.from(payLegDefinition, receiveLegDefinition);
}