Пример #1
0
        /// <summary>
        /// Method to copy the data in this Sparse6DMatrix instance to another instance.
        /// </summary>
        /// <param name="sparse6DMatrix">An instance of the Sparse6DMatrix class.</param>
        public void CopyTo(Sparse6DMatrix <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TValue> sparse6DMatrix)
        {
            sparse6DMatrix.m_dictionary.Clear();

            // Copy each key value pair to the dictionary.
            foreach (KeyValuePair <ComparableTuple6 <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5>, TValue> pair in m_dictionary)
            {
                ComparableTuple6 <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5> newCombinedKey = new ComparableTuple6 <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5>(pair.Key);
                sparse6DMatrix.m_dictionary.Add(newCombinedKey, pair.Value);
            }
        }
Пример #2
0
        /// <summary>
        /// Method to copy the data in another Sparse6DMatrix instance to this instance.
        /// </summary>
        /// <param name="sparse6DMatrix">An instance of the Sparse6DMatrix class.</param>
        private void Initialize(Sparse6DMatrix <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TValue> sparse6DMatrix)
        {
            m_dictionary.Clear();

            // Copy each key value pair to the dictionary.
            foreach (KeyValuePair <ComparableTuple6 <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5>, TValue> pair in sparse6DMatrix)
            {
                ComparableTuple6 <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5> newCombinedKey = new ComparableTuple6 <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5>(pair.Key);
                m_dictionary.Add(newCombinedKey, pair.Value);
            }
        }
Пример #3
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="sparse6DMatrix">The sparse array instance to be copied</param>
 public Sparse6DMatrix(Sparse6DMatrix <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TValue> sparse6DMatrix)
 {
     InitializeDictionary();
     Initialize(sparse6DMatrix);
     DefaultValue = sparse6DMatrix.DefaultValue;
 }