@Override
 public Set<ComputedValue> getResults(
     final InstrumentDerivative derivative,
     final String curveName,
     final InterpolatedYieldCurveSpecificationWithSecurities curveSpec,
     final YieldCurveBundle curves,
     final ValueSpecification resultSpec) {
   final Map<String, Double> pv01 = CALCULATOR.visit(derivative, curves);
   if (!pv01.containsKey(curveName)) {
     throw new OpenGammaRuntimeException(
         "Could not get PV01 for curve named " + curveName + "; should never happen");
   }
   return Collections.singleton(new ComputedValue(resultSpec, pv01.get(curveName)));
 }
/**
 * @deprecated Use the version that does not refer to funding or forward curves
 * @see InterestRateInstrumentPV01Function
 */
@Deprecated
public class InterestRateInstrumentPV01FunctionDeprecated
    extends InterestRateInstrumentCurveSpecificFunctionDeprecated {
  private static final PV01Calculator CALCULATOR = PV01Calculator.getInstance();

  public InterestRateInstrumentPV01FunctionDeprecated() {
    super(ValueRequirementNames.PV01);
  }

  @Override
  public Set<ComputedValue> getResults(
      final InstrumentDerivative derivative,
      final String curveName,
      final InterpolatedYieldCurveSpecificationWithSecurities curveSpec,
      final YieldCurveBundle curves,
      final ValueSpecification resultSpec) {
    final Map<String, Double> pv01 = CALCULATOR.visit(derivative, curves);
    if (!pv01.containsKey(curveName)) {
      throw new OpenGammaRuntimeException(
          "Could not get PV01 for curve named " + curveName + "; should never happen");
    }
    return Collections.singleton(new ComputedValue(resultSpec, pv01.get(curveName)));
  }
}