MultipleCurrencyInterestRateCurveSensitivity { public MultipleCurrencyInterestRateCurveSensitivity plus(final Currency ccy, final InterestRateCurveSensitivity sensitivity) { ArgumentChecker.notNull(ccy, "Currency"); ArgumentChecker.notNull(sensitivity, "Sensitivity"); final TreeMap<Currency, InterestRateCurveSensitivity> map = new TreeMap<>(); if (_sensitivity.containsKey(ccy)) { map.put(ccy, sensitivity.plus(_sensitivity.get(ccy))); for (final Currency loopccy : _sensitivity.keySet()) { if (loopccy != ccy) { map.put(loopccy, _sensitivity.get(loopccy)); } } } else { map.putAll(_sensitivity); map.put(ccy, sensitivity); } return new MultipleCurrencyInterestRateCurveSensitivity(map); } MultipleCurrencyInterestRateCurveSensitivity(); private  MultipleCurrencyInterestRateCurveSensitivity(final TreeMap<Currency, InterestRateCurveSensitivity> sensitivity); static MultipleCurrencyInterestRateCurveSensitivity of(final Currency ccy, final InterestRateCurveSensitivity sensitivity); InterestRateCurveSensitivity getSensitivity(final Currency ccy); MultipleCurrencyInterestRateCurveSensitivity plus(final Currency ccy, final InterestRateCurveSensitivity sensitivity); MultipleCurrencyInterestRateCurveSensitivity plus(final MultipleCurrencyInterestRateCurveSensitivity other); MultipleCurrencyInterestRateCurveSensitivity multipliedBy(final double factor); MultipleCurrencyInterestRateCurveSensitivity cleaned(); Set<Currency> getCurrencies(); MultipleCurrencyInterestRateCurveSensitivity converted(final Currency ccy, final FXMatrix fx); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void plus() { final double tolerance = 1.0E-2; MultipleCurrencyInterestRateCurveSensitivity mcIRCS = MultipleCurrencyInterestRateCurveSensitivity.of(USD, IRCS); assertEquals("MultipleCurrencyInterestRateCurveSensitivity", IRCS, mcIRCS.getSensitivity(USD)); mcIRCS = mcIRCS.plus(EUR, IRCS_EMPTY); assertEquals("MultipleCurrencyInterestRateCurveSensitivity", IRCS, mcIRCS.getSensitivity(USD)); assertEquals("MultipleCurrencyInterestRateCurveSensitivity", IRCS_EMPTY, mcIRCS.getSensitivity(EUR)); mcIRCS = mcIRCS.plus(USD, IRCS); AssertSensitivityObjects.assertEquals("MultipleCurrencyInterestRateCurveSensitivity", IRCS.multipliedBy(2.0), mcIRCS.getSensitivity(USD).cleaned(), tolerance); assertEquals("MultipleCurrencyInterestRateCurveSensitivity", IRCS_EMPTY, mcIRCS.getSensitivity(EUR)); }