class IborCapFloorTradeCalculationFunction implements CalculationFunction<IborCapFloorTrade> {

  @Override
  public Map<Measure, Result<?>> calculate(
      IborCapFloorTrade trade,
      Set<Measure> measures,
      CalculationParameters parameters,
      ScenarioMarketData scenarioMarketData,
      ReferenceData refData) {

    // expand the trade once for all measures and all scenarios
    ResolvedIborCapFloorTrade resolved = trade.resolve(refData);
    RatesMarketDataLookup ratesLookup = parameters.getParameter(RatesMarketDataLookup.class);
    RatesScenarioMarketData ratesMarketData = ratesLookup.marketDataView(scenarioMarketData);
    IborCapFloorMarketDataLookup capFloorLookup = parameters.getParameter(IborCapFloorMarketDataLookup.class);
    IborCapFloorScenarioMarketData capFloorMarketData = capFloorLookup.marketDataView(scenarioMarketData);

    // loop around measures, calculating all scenarios for one measure
    Map<Measure, Result<?>> results = new HashMap<>();
    for (Measure measure : measures) {
      results.put(measure, calculate(measure, resolved, ratesMarketData, capFloorMarketData));
    }
    return results;
  }

  public  IborCapFloorTradeCalculationFunction();

}