示例#1
0
        //-------------------------------------------------------------------------
        // parse the sensitivity info
        private PortfolioItemInfo parseInfo(CsvRow row)
        {
            PortfolioItemInfo info   = PortfolioItemInfo.empty();
            string            scheme = row.findValue(ID_SCHEME_HEADER).orElse(DEFAULT_SCHEME);
            StandardId        id     = row.findValue(ID_HEADER).map(str => StandardId.of(scheme, str)).orElse(null);

            if (id != null)
            {
                info = info.withId(id);
            }
            return(resolver.parseSensitivityInfo(row, info));
        }
        /// <summary>
        /// Combines this set of sensitivities with another set.
        /// <para>
        /// This returns a new curve sensitivities with a combined map of typed sensitivities.
        /// Any sensitivities of the same type will be combined as though using
        /// <seealso cref="CurrencyParameterSensitivities#mergedWith(CurrencyParameterSensitivities)"/>.
        /// The identifier and attributes of this instance will take precedence.
        ///
        /// </para>
        /// </summary>
        /// <param name="other">  the other parameter sensitivities </param>
        /// <returns> an instance based on this one, with the other instance added </returns>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings({"rawtypes", "unchecked"}) public CurveSensitivities mergedWith(CurveSensitivities other)
        public CurveSensitivities mergedWith(CurveSensitivities other)
        {
            PortfolioItemInfo combinedInfo = info;

            if (!info.Id.Present && other.info.Id.Present)
            {
                combinedInfo = combinedInfo.withId(other.info.Id.get());
            }
            foreach (AttributeType attrType in other.info.AttributeTypes)
            {
                if (!combinedInfo.AttributeTypes.contains(attrType))
                {
                    combinedInfo = combinedInfo.withAttribute(attrType, other.info.getAttribute(attrType));
                }
            }
            return(new CurveSensitivities(combinedInfo, mergedWith(other.typedSensitivities).TypedSensitivities));
        }