class CashDiscountingMethod {

  public MulticurveSensitivity parSpreadCurveSensitivity(final Cash deposit, final MulticurveProviderInterface curves) {
    ArgumentChecker.notNull(deposit, "Deposit");
    ArgumentChecker.notNull(curves, "Multicurves");
    ArgumentChecker.isTrue(deposit.getNotional() != 0.0, "Notional is 0");
    final double dfStart = curves.getDiscountFactor(deposit.getCurrency(), deposit.getStartTime());
    final double dfEnd = curves.getDiscountFactor(deposit.getCurrency(), deposit.getEndTime());
    // Backward sweep
    final double parSpreadBar = 1.0;
    final double dfEndBar = -(deposit.getInitialAmount() * dfStart / (dfEnd * dfEnd)) / (deposit.getNotional() * deposit.getAccrualFactor()) * parSpreadBar;
    final double dfStartBar = (deposit.getInitialAmount() / dfEnd) / (deposit.getNotional() * deposit.getAccrualFactor()) * parSpreadBar;
    final Map<String, List<DoublesPair>> mapDsc = new HashMap<>();
    final List<DoublesPair> listDiscounting = new ArrayList<>();
    listDiscounting.add(DoublesPair.of(deposit.getStartTime(), -deposit.getStartTime() * dfStart * dfStartBar));
    listDiscounting.add(DoublesPair.of(deposit.getEndTime(), -deposit.getEndTime() * dfEnd * dfEndBar));
    mapDsc.put(curves.getName(deposit.getCurrency()), listDiscounting);
    return MulticurveSensitivity.ofYieldDiscounting(mapDsc);
  }

  private  CashDiscountingMethod();

}