Exemple #1
0
        /// <summary>
        /// The method is used to retrieve the local codes for a list
        /// of data structure definition list codes.
        /// </summary>
        /// <param name="dsdCodes">
        /// The data structure definition list
        /// </param>
        /// <returns>
        /// The list of local codes
        /// </returns>
        public CodeSetCollection GetLocalCodes(CodeCollection dsdCodes)
        {
            CodeSetCollection codes;

            if (!this._dsdCodesAsKey.TryGetValue(dsdCodes, out codes))
            {
                codes = new CodeSetCollection {
                    dsdCodes
                };
            }

            return(codes);
        }
Exemple #2
0
        /*
         * Not used anywhere
         * /// <summary>
         * /// Gets the transcoding dictionary for positions as columns
         * /// </summary>
         * public Dictionary<int, string> PositionAsKeyColumn
         * {
         *  get
         *  {
         *      return this._positionAsKeyColumn;
         *  }
         * }
         *
         * /// <summary>
         * /// Gets the transcoding dictionary for positions as key component
         * /// </summary>
         * public Dictionary<int, string> PositionAsKeyComponent
         * {
         *  get
         *  {
         *      return this._positionAsKeyComponent;
         *  }
         * }
         */
        #region Public Methods

        /// <summary>
        /// The method is used to add a new component transcoding into
        /// the coresponding dictionaries
        /// </summary>
        /// <param name="localCodes">
        /// The list local codes
        /// </param>
        /// <param name="dsdCodes">
        /// The list of data structure definition codes
        /// </param>
        public void Add(CodeCollection localCodes, CodeCollection dsdCodes)
        {
            if (this._localCodesAsKey.ContainsKey(localCodes))
            {
                string localCodesKey = ConvertToString(localCodes);
                string dsdCodesKey   = ConvertToString(dsdCodes);
                throw new ArgumentException(
                          "Duplicate code mapping found.\nLocal code(s) : " + localCodesKey
                          + " mapped to two or more sets of SDMX Codes.\n Set 1 :"
                          + ConvertToString(this._localCodesAsKey[localCodes]) + "\n Set 2: " + dsdCodesKey);
            }

            CodeSetCollection localCodesSet;

            if (!this._dsdCodesAsKey.TryGetValue(dsdCodes, out localCodesSet))
            {
                localCodesSet = new CodeSetCollection();
                this._dsdCodesAsKey.Add(dsdCodes, localCodesSet);
            }

            localCodesSet.Add(localCodes);

            // NON MAT200
            // _dsdCodesAsKey.Add(dsdCodesKey, localCodes);
            this._localCodesAsKey.Add(localCodes, dsdCodes);

            // for N comp to 1 col
            for (int i = 0; i < dsdCodes.Count; i++)
            {
                List <string> list;
                if (!this._manyComponentToOneColumn[i].TryGetValue(dsdCodes[i], out list))
                {
                    list = new List <string>();
                    this._manyComponentToOneColumn[i].Add(dsdCodes[i], list);
                }

                list.Add(localCodes[0]);
            }

            // }
        }