private void addToComponentSpecificHandlers(Type type, EventHandlerInfo handlerInfo, Type c) { SetMultimap <Type, EventHandlerInfo> componentMap = componentSpecificHandlers[type]; if (componentMap == null) { componentMap = HashMultimap.create(); componentSpecificHandlers[type] = componentMap; } componentMap.put(c, handlerInfo); }
/// <summary> /// Obtains a generator from an existing provider and definition. /// </summary> /// <param name="knownProvider"> the underlying known provider </param> /// <param name="groupDefn"> the curve group definition </param> /// <param name="refData"> the reference data to use </param> /// <returns> the generator </returns> public static ImmutableRatesProviderGenerator of(ImmutableRatesProvider knownProvider, RatesCurveGroupDefinition groupDefn, ReferenceData refData) { IList <CurveDefinition> curveDefns = new List <CurveDefinition>(); IList <CurveMetadata> curveMetadata = new List <CurveMetadata>(); SetMultimap <CurveName, Currency> discountNames = HashMultimap.create(); SetMultimap <CurveName, Index> indexNames = HashMultimap.create(); foreach (CurveDefinition curveDefn in groupDefn.CurveDefinitions) { curveDefns.Add(curveDefn); curveMetadata.Add(curveDefn.metadata(knownProvider.ValuationDate, refData)); CurveName curveName = curveDefn.Name; // A curve group is guaranteed to include an entry for every definition RatesCurveGroupEntry entry = groupDefn.findEntry(curveName).get(); ISet <Currency> ccy = entry.DiscountCurrencies; discountNames.putAll(curveName, ccy); indexNames.putAll(curveName, entry.Indices); } return(new ImmutableRatesProviderGenerator(knownProvider, curveDefns, curveMetadata, discountNames, indexNames)); }