new RelinkableHandle<BlackVolTermStructure>(process.blackVolatility().currentLink());
final GeneralizedBlackScholesProcess bsProcess =
new GeneralizedBlackScholesProcess(stateVariable, dividendTS, riskFreeTS, volTS);
final AnalyticEuropeanEngine baseEngine = new AnalyticEuropeanEngine(bsProcess);
final VanillaOption.ArgumentsImpl baseArguments = (VanillaOption.ArgumentsImpl) baseEngine.getArguments();
baseArguments.payoff = A.payoff;
baseArguments.exercise = A.exercise;
baseArguments.validate();
final VanillaOption.ResultsImpl baseResults = (VanillaOption.ResultsImpl) baseEngine.getResults();
R.value = 0.0;
greeks.delta = 0.0;
greeks.gamma = 0.0;
greeks.theta = 0.0;
greeks.vega = 0.0;
greeks.rho = 0.0;
greeks.dividendRho = 0.0;
double /* @Real */ r, v, weight, lastContribution = 1.0;
double /* @Real */ theta_correction;
int i;
for (i = 0; lastContribution > relativeAccuracy && i < maxIterations || i < (int)(lambda*t); i++) {
// constant vol/rate assumption. It should be relaxed
v = Math.sqrt((variance + i * jumpSquareVol) / t);
r = riskFreeRate - process.jumpIntensity().currentLink().value() * k + i * muPlusHalfSquareVol / t;
riskFreeTS.linkTo(new FlatForward(rateRefDate, r, voldc));
volTS.linkTo(new BlackConstantVol(rateRefDate, volcal, v, voldc));
baseArguments.validate();
baseEngine.calculate();
weight = p.op(i);
R.value += weight * baseResults.value;
greeks.delta += weight * baseResults.greeks().delta;
greeks.gamma += weight * baseResults.greeks().gamma;