}
@Override
protected Set<ComputedValue> getResult(final Forex fxForward, final YieldCurveBundle data, final ComputationTarget target, final Set<ValueRequirement> desiredValues,
final FunctionInputs inputs, final ValueSpecification spec, final FunctionExecutionContext executionContext) {
final FXForwardSecurity security = (FXForwardSecurity) target.getSecurity();
final ValueRequirement desiredValue = Iterables.getOnlyElement(desiredValues);
final String curveCurrency = desiredValue.getConstraint(ValuePropertyNames.CURVE_CURRENCY);
final String curveName = desiredValue.getConstraint(ValuePropertyNames.CURVE);
final Object curveCalculationConfigObject = inputs.getValue(ValueRequirementNames.CURVE_CALCULATION_CONFIG);
if (curveCalculationConfigObject == null) {
throw new OpenGammaRuntimeException("Could not get curve calculation configuration");
}
final MultiCurveCalculationConfig curveCalculationConfig = (MultiCurveCalculationConfig) curveCalculationConfigObject;
final Object curveSensitivitiesObject = inputs.getValue(ValueRequirementNames.FX_CURVE_SENSITIVITIES);
if (curveSensitivitiesObject == null) {
throw new OpenGammaRuntimeException("Could not get curve sensitivities");
}
final MultipleCurrencyInterestRateCurveSensitivity curveSensitivities = (MultipleCurrencyInterestRateCurveSensitivity) curveSensitivitiesObject;
final Currency payCurrency = security.accept(ForexVisitors.getPayCurrencyVisitor());
final Currency receiveCurrency = security.accept(ForexVisitors.getReceiveCurrencyVisitor());
final String fullCurveName = curveName + "_" + curveCurrency;
if (curveCalculationConfig.getCalculationMethod().equals(FXImpliedYieldCurveFunction.FX_IMPLIED)) {
final ConfigSource configSource = OpenGammaExecutionContext.getConfigSource(executionContext);
final ConfigDBFXForwardCurveDefinitionSource definitionSource = new ConfigDBFXForwardCurveDefinitionSource(configSource);
final UnorderedCurrencyPair currencyPair = UnorderedCurrencyPair.of(payCurrency, receiveCurrency);