Exemplo n.º 1
0
        /// <summary>
        /// Method to copy the data in another Sparse7DMatrix instance to this instance.
        /// </summary>
        /// <param name="sparse7DMatrix">An instance of the Sparse7DMatrix class.</param>
        private void Initialize(Sparse7DMatrix <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TKey6, TValue> sparse7DMatrix)
        {
            m_dictionary.Clear();

            // Copy each key value pair to the dictionary.
            foreach (KeyValuePair <ComparableTuple7 <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TKey6>, TValue> pair in sparse7DMatrix)
            {
                ComparableTuple7 <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TKey6> newCombinedKey = new ComparableTuple7 <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TKey6>(pair.Key);
                m_dictionary.Add(newCombinedKey, pair.Value);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Method to copy the data in this Sparse7DMatrix instance to another instance.
        /// </summary>
        /// <param name="sparse7DMatrix">An instance of the Sparse7DMatrix class.</param>
        public void CopyTo(Sparse7DMatrix <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TKey6, TValue> sparse7DMatrix)
        {
            sparse7DMatrix.m_dictionary.Clear();

            // Copy each key value pair to the dictionary.
            foreach (KeyValuePair <ComparableTuple7 <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TKey6>, TValue> pair in m_dictionary)
            {
                ComparableTuple7 <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TKey6> newCombinedKey = new ComparableTuple7 <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TKey6>(pair.Key);
                sparse7DMatrix.m_dictionary.Add(newCombinedKey, pair.Value);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="sparse7DMatrix">The sparse array instance to be copied</param>
 public Sparse7DMatrix(Sparse7DMatrix <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TKey6, TValue> sparse7DMatrix)
 {
     InitializeDictionary();
     Initialize(sparse7DMatrix);
     DefaultValue = sparse7DMatrix.DefaultValue;
 }