// parse all the root-level party elements
        private static ImmutableListMultimap <string, string> parseParties(XmlElement root)
        {
            ListMultimap <string, string> parties = ArrayListMultimap.create();

            foreach (XmlElement child in root.getChildren("party"))
            {
                parties.putAll(child.getAttribute(ID), findPartyIds(child));
            }
            return(ImmutableListMultimap.copyOf(parties));
        }
Exemplo n.º 2
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Parses one or more CSV format position files, returning sensitivities.
        /// <para>
        /// The standard way to write sensitivities files is for each file to contain one sensitivity instance.
        /// The file format can handle multiple instances per file, where each instance has a separate identifier.
        /// Most files will not have the identifier columns, thus the identifier will be the empty string.
        /// </para>
        /// <para>
        /// The returned multimap is keyed by identifier. The value will contain one entry for each instance.
        /// If desired, the results can be reduced using <seealso cref="CurveSensitivities#mergedWith(CurveSensitivities)"/>
        /// to merge those with the same identifier.
        /// </para>
        /// <para>
        /// CSV files sometimes contain a Unicode Byte Order Mark.
        /// Callers are responsible for handling this, such as by using <seealso cref="UnicodeBom"/>.
        ///
        /// </para>
        /// </summary>
        /// <param name="charSources">  the CSV character sources </param>
        /// <returns> the loaded sensitivities, parsing errors are captured in the result </returns>
        public ValueWithFailures <ListMultimap <string, CurveSensitivities> > parse(ICollection <CharSource> charSources)
        {
            ListMultimap <string, CurveSensitivities> parsed = ArrayListMultimap.create();
            IList <FailureItem> failures = new List <FailureItem>();

            foreach (CharSource charSource in charSources)
            {
                parse(charSource, parsed, failures);
            }
            return(ValueWithFailures.of(ImmutableListMultimap.copyOf(parsed), failures));
        }
 /// <summary>
 /// Obtains an instance from a map allowing for multiple values for each key.
 /// <para>
 /// The returned instance may have more than one value for each key.
 ///
 /// </para>
 /// </summary>
 /// <param name="keyValues">  the key-values to create the instance with </param>
 /// <returns> the property set </returns>
 public static PropertySet of(Multimap <string, string> keyValues)
 {
     ArgChecker.notNull(keyValues, "keyValues");
     return(new PropertySet(ImmutableListMultimap.copyOf(keyValues)));
 }