Exemplo n.º 1
0
        /// <summary>
        /// The metod is used to retrieve the list of data structure definition codes
        /// for a list of local codes
        /// </summary>
        /// <param name="localCodes">
        /// The list of local codes
        /// </param>
        /// <returns>
        /// The list of data structure definition codes
        /// </returns>
        public CodeCollection GetDsdCodes(CodeCollection localCodes)
        {
            CodeCollection codes;

            if (!this._localCodesAsKey.TryGetValue(localCodes, out codes))
            {
                codes = null;
            }

            return(codes);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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]);
            }

            // }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Gets the hash code from the collections contents
 /// </summary>
 /// <param name="obj">
 /// The collection to get the hash code from
 /// </param>
 /// <returns>
 /// The hash code
 /// </returns>
 public int GetHashCode(CodeCollection obj)
 {
     return(this.GetHashCode((Collection <string>)obj));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Checks if two collection, <paramref name="x"/> and <paramref name="y"/> are equal regarding their contents
 /// </summary>
 /// <param name="x">
 /// The x.
 /// </param>
 /// <param name="y">
 /// The y.
 /// </param>
 /// <returns>
 /// <c>true</c> if the collections are equal. Else <c>false</c>.
 /// </returns>
 public bool Equals(CodeCollection x, CodeCollection y)
 {
     return(this.Equals((Collection <string>)x, y));
 }