private static Multimap <LocalDate, Curve> parseSingle(System.Predicate <LocalDate> datePredicate, CharSource curvesResource, IDictionary <CurveName, LoadedCurveSettings> settingsMap)
        {
            CsvFile csv = CsvFile.of(curvesResource, true);
            IDictionary <LoadedCurveKey, IList <LoadedCurveNode> > allNodes = new Dictionary <LoadedCurveKey, IList <LoadedCurveNode> >();

            foreach (CsvRow row in csv.rows())
            {
                string dateStr       = row.getField(CURVE_DATE);
                string curveNameStr  = row.getField(CURVE_NAME);
                string pointDateStr  = row.getField(CURVE_POINT_DATE);
                string pointValueStr = row.getField(CURVE_POINT_VALUE);
                string pointLabel    = row.getField(CURVE_POINT_LABEL);

                LocalDate date = LoaderUtils.parseDate(dateStr);
                if (datePredicate(date))
                {
                    LocalDate pointDate  = LoaderUtils.parseDate(pointDateStr);
                    double    pointValue = Convert.ToDouble(pointValueStr);

                    LoadedCurveKey          key        = LoadedCurveKey.of(date, CurveName.of(curveNameStr));
                    IList <LoadedCurveNode> curveNodes = allNodes.computeIfAbsent(key, k => new List <LoadedCurveNode>());
                    curveNodes.Add(LoadedCurveNode.of(pointDate, pointValue, pointLabel));
                }
            }
            return(buildCurves(settingsMap, allNodes));
        }
 //-----------------------------------------------------------------------
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         LoadedCurveKey other = (LoadedCurveKey)obj;
         return(JodaBeanUtils.equal(curveDate, other.curveDate) && JodaBeanUtils.equal(curveName, other.curveName));
     }
     return(false);
 }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            coverPrivateConstructor(typeof(RatesCurvesCsvLoader));
            LoadedCurveKey.meta();
            coverImmutableBean(LoadedCurveKey.of(CURVE_DATE, CurveName.of("Test")));
            LoadedCurveNode.meta();
            coverImmutableBean(LoadedCurveNode.of(CURVE_DATE, 1d, "Test"));
            LoadedCurveSettings.meta();
            LoadedCurveSettings settings1 = LoadedCurveSettings.of(CurveName.of("Test"), ValueType.YEAR_FRACTION, ValueType.ZERO_RATE, DayCounts.ACT_365F, CurveInterpolators.LINEAR, CurveExtrapolators.FLAT, CurveExtrapolators.FLAT);
            LoadedCurveSettings settings2 = LoadedCurveSettings.of(CurveName.of("Test2"), ValueType.YEAR_FRACTION, ValueType.DISCOUNT_FACTOR, DayCounts.ACT_ACT_ISDA, CurveInterpolators.LOG_LINEAR, CurveExtrapolators.LINEAR, CurveExtrapolators.LINEAR);

            coverImmutableBean(settings1);
            coverBeanEquals(settings1, settings2);
        }
        private static Multimap <LocalDate, Curve> buildCurves(IDictionary <CurveName, LoadedCurveSettings> settingsMap, IDictionary <LoadedCurveKey, IList <LoadedCurveNode> > allNodes)
        {
            ImmutableMultimap.Builder <LocalDate, Curve> results = ImmutableMultimap.builder();

            foreach (KeyValuePair <LoadedCurveKey, IList <LoadedCurveNode> > entry in allNodes.SetOfKeyValuePairs())
            {
                LoadedCurveKey      key      = entry.Key;
                LoadedCurveSettings settings = settingsMap[key.CurveName];

                if (settings == null)
                {
                    throw new System.ArgumentException(Messages.format("Missing settings for curve: {}", key));
                }
                results.put(key.CurveDate, settings.createCurve(key.CurveDate, entry.Value));
            }
            return(results.build());
        }