public BondFutureOptionMarketData scenario(int scenarioIndex)
        {
            BondFutureOptionMarketData current = cache.get(scenarioIndex);

            if (current != null)
            {
                return(current);
            }
            return(cache.updateAndGet(scenarioIndex, v => v != null ? v : lookup.marketDataView(marketData.scenario(scenarioIndex))));
        }
        //-------------------------------------------------------------------------
        public virtual void test_marketDataView()
        {
            BondFutureOptionMarketDataLookup test = BondFutureOptionMarketDataLookup.of(SEC_OG1, VOL_ID1);
            LocalDate          valDate            = date(2015, 6, 30);
            ScenarioMarketData md = new TestMarketDataMap(valDate, ImmutableMap.of(), ImmutableMap.of());
            BondFutureOptionScenarioMarketData multiScenario = test.marketDataView(md);

            assertEquals(multiScenario.Lookup, test);
            assertEquals(multiScenario.MarketData, md);
            assertEquals(multiScenario.ScenarioCount, 1);
            BondFutureOptionMarketData scenario = multiScenario.scenario(0);

            assertEquals(scenario.Lookup, test);
            assertEquals(scenario.MarketData, md.scenario(0));
            assertEquals(scenario.ValuationDate, valDate);
        }
        //-------------------------------------------------------------------------
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: @Override public java.util.Map<com.opengamma.strata.calc.Measure, com.opengamma.strata.collect.result.Result<?>> calculate(T target, java.util.Set<com.opengamma.strata.calc.Measure> measures, com.opengamma.strata.calc.runner.CalculationParameters parameters, com.opengamma.strata.data.scenario.ScenarioMarketData scenarioMarketData, com.opengamma.strata.basics.ReferenceData refData)
        public virtual IDictionary <Measure, Result <object> > calculate(T target, ISet <Measure> measures, CalculationParameters parameters, ScenarioMarketData scenarioMarketData, ReferenceData refData)
        {
            // resolve the trade once for all measures and all scenarios
            ResolvedBondFutureOptionTrade resolved = target.resolve(refData);

            // use lookup to query market data
            LegalEntityDiscountingMarketDataLookup   ledLookup        = parameters.getParameter(typeof(LegalEntityDiscountingMarketDataLookup));
            LegalEntityDiscountingScenarioMarketData ledMarketData    = ledLookup.marketDataView(scenarioMarketData);
            BondFutureOptionMarketDataLookup         optionLookup     = parameters.getParameter(typeof(BondFutureOptionMarketDataLookup));
            BondFutureOptionScenarioMarketData       optionMarketData = optionLookup.marketDataView(scenarioMarketData);

            // loop around measures, calculating all scenarios for one measure
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<com.opengamma.strata.calc.Measure, com.opengamma.strata.collect.result.Result<?>> results = new java.util.HashMap<>();
            IDictionary <Measure, Result <object> > results = new Dictionary <Measure, Result <object> >();

            foreach (Measure measure in measures)
            {
                results[measure] = calculate(measure, resolved, ledMarketData, optionMarketData);
            }
            return(results);
        }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Calculates present value across one or more scenarios.
 /// </summary>
 /// <param name="trade">  the trade </param>
 /// <param name="legalEntityLookup">  the lookup used to query the rates market data </param>
 /// <param name="volsLookup">  the lookup used to query the volatility market data </param>
 /// <param name="marketData">  the market data </param>
 /// <returns> the present value, one entry per scenario </returns>
 public virtual CurrencyScenarioArray presentValue(ResolvedBondFutureOptionTrade trade, LegalEntityDiscountingMarketDataLookup legalEntityLookup, BondFutureOptionMarketDataLookup volsLookup, ScenarioMarketData marketData)
 {
     return(calc.presentValue(trade, legalEntityLookup.marketDataView(marketData), volsLookup.marketDataView(marketData)));
 }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Calculates unit price across one or more scenarios.
 /// <para>
 /// This is the price of a single unit of the security.
 ///
 /// <h4>Price</h4>
 /// Strata uses <i>decimal prices</i> for bond futures options in the trade model, pricers and market data.
 /// This is coherent with the pricing of <seealso cref="BondFuture"/>.
 ///
 /// </para>
 /// </summary>
 /// <param name="trade">  the trade </param>
 /// <param name="legalEntityLookup">  the lookup used to query the rates market data </param>
 /// <param name="volsLookup">  the lookup used to query the volatility market data </param>
 /// <param name="marketData">  the market data </param>
 /// <returns> the present value, one entry per scenario </returns>
 public virtual DoubleScenarioArray unitPrice(ResolvedBondFutureOptionTrade trade, LegalEntityDiscountingMarketDataLookup legalEntityLookup, BondFutureOptionMarketDataLookup volsLookup, ScenarioMarketData marketData)
 {
     return(calc.unitPrice(trade, legalEntityLookup.marketDataView(marketData), volsLookup.marketDataView(marketData)));
 }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Calculates present value sensitivity across one or more scenarios.
 /// <para>
 /// This is the sensitivity of
 /// <seealso cref="#presentValue(ResolvedBondFutureOptionTrade, LegalEntityDiscountingMarketDataLookup, BondFutureOptionMarketDataLookup, ScenarioMarketData) present value"/>
 /// to a one basis point shift in the calibrated curves.
 /// The result is provided for each affected curve and currency, bucketed by curve node.
 ///
 /// </para>
 /// </summary>
 /// <param name="trade">  the trade </param>
 /// <param name="legalEntityLookup">  the lookup used to query the rates market data </param>
 /// <param name="volsLookup">  the lookup used to query the volatility market data </param>
 /// <param name="marketData">  the market data </param>
 /// <returns> the present value sensitivity, one entry per scenario </returns>
 public virtual ScenarioArray <CurrencyParameterSensitivities> pv01CalibratedBucketed(ResolvedBondFutureOptionTrade trade, LegalEntityDiscountingMarketDataLookup legalEntityLookup, BondFutureOptionMarketDataLookup volsLookup, ScenarioMarketData marketData)
 {
     return(calc.pv01CalibratedBucketed(trade, legalEntityLookup.marketDataView(marketData), volsLookup.marketDataView(marketData)));
 }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Calculates present value sensitivity across one or more scenarios.
 /// <para>
 /// This is the sensitivity of
 /// <seealso cref="#presentValue(ResolvedBondFutureOptionTrade, LegalEntityDiscountingMarketDataLookup, BondFutureOptionMarketDataLookup, ScenarioMarketData) present value"/>
 /// to a one basis point shift in the calibrated curves.
 /// The result is the sum of the sensitivities of all affected curves.
 ///
 /// </para>
 /// </summary>
 /// <param name="trade">  the trade </param>
 /// <param name="legalEntityLookup">  the lookup used to query the rates market data </param>
 /// <param name="volsLookup">  the lookup used to query the volatility market data </param>
 /// <param name="marketData">  the market data </param>
 /// <returns> the present value sensitivity, one entry per scenario </returns>
 public virtual MultiCurrencyScenarioArray pv01CalibratedSum(ResolvedBondFutureOptionTrade trade, LegalEntityDiscountingMarketDataLookup legalEntityLookup, BondFutureOptionMarketDataLookup volsLookup, ScenarioMarketData marketData)
 {
     return(calc.pv01CalibratedSum(trade, legalEntityLookup.marketDataView(marketData), volsLookup.marketDataView(marketData)));
 }