if (spotLag == 0 && conventionSettlementRegion == null) {
spotDate = now;
} else {
spotDate = now;
}
final YieldCurveBundle curves = new YieldCurveBundle();
final String fullYieldCurveName = _originalCurveName + "_" + _currency;
curves.setCurve(fullYieldCurveName, (YieldAndDiscountCurve) originalCurveObject);
final int n = _impliedDefinition.getStrips().size();
final double[] t = new double[n];
final double[] r = new double[n];
int i = 0;
final DayCount dayCount = DayCountFactory.INSTANCE.getDayCount("Act/365"); //TODO
final String impliedDepositCurveName = _curveCalculationConfig + "_" + _currency.getCode();
final List<InstrumentDerivative> derivatives = new ArrayList<>();
for (final FixedIncomeStrip strip : _impliedDefinition.getStrips()) {
final Tenor tenor = strip.getCurveNodePointTime();
final ZonedDateTime paymentDate = ScheduleCalculator.getAdjustedDate(spotDate, tenor.getPeriod(), MOD_FOL, calendar, true);
final double startTime = TimeCalculator.getTimeBetween(now, spotDate);
final double endTime = TimeCalculator.getTimeBetween(now, paymentDate);
final double accrualFactor = dayCount.getDayCountFraction(now, now.plus(tenor.getPeriod()), calendar);
final Cash cashFXCurve = new Cash(_currency, startTime, endTime, 1, 0, accrualFactor, fullYieldCurveName);
final double parRate = METHOD_CASH.parRate(cashFXCurve, curves);
final Cash cashDepositCurve = new Cash(_currency, startTime, endTime, 1, 0, accrualFactor, impliedDepositCurveName);
derivatives.add(cashDepositCurve);
t[i] = endTime;
r[i++] = parRate;
}
final CombinedInterpolatorExtrapolator interpolator = CombinedInterpolatorExtrapolatorFactory.getInterpolator(_interpolatorName, _leftExtrapolatorName,
_rightExtrapolatorName);
final double absoluteTolerance = Double.parseDouble(absoluteToleranceName);
final double relativeTolerance = Double.parseDouble(relativeToleranceName);
final int iterations = Integer.parseInt(iterationsName);
final Decomposition<?> decomposition = DecompositionFactory.getDecomposition(decompositionName);
final boolean useFiniteDifference = Boolean.parseBoolean(useFiniteDifferenceName);
final LinkedHashMap<String, double[]> curveNodes = new LinkedHashMap<>();
final LinkedHashMap<String, Interpolator1D> interpolators = new LinkedHashMap<>();
curveNodes.put(impliedDepositCurveName, t);
interpolators.put(impliedDepositCurveName, interpolator);
final FXMatrix fxMatrix = new FXMatrix();
final YieldCurveBundle knownCurve = new YieldCurveBundle();
final MultipleYieldCurveFinderDataBundle data = new MultipleYieldCurveFinderDataBundle(derivatives, r, knownCurve, curveNodes, interpolators, useFiniteDifference, fxMatrix);
final NewtonVectorRootFinder rootFinder = new BroydenVectorRootFinder(absoluteTolerance, relativeTolerance, iterations, decomposition);
final Function1D<DoubleMatrix1D, DoubleMatrix1D> curveCalculator = new MultipleYieldCurveFinderFunction(data, PAR_RATE_CALCULATOR);
final Function1D<DoubleMatrix1D, DoubleMatrix2D> jacobianCalculator = new MultipleYieldCurveFinderJacobian(data, PAR_RATE_SENSITIVITY_CALCULATOR);
final double[] fittedYields = rootFinder.getRoot(curveCalculator, jacobianCalculator, new DoubleMatrix1D(r)).getData();