/// <summary> /// Method to copy the data in another Sparse8DMatrix instance to this instance. /// </summary> /// <param name="sparse8DMatrix">An instance of the Sparse8DMatrix class.</param> private void Initialize(Sparse8DMatrix <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TKey6, TKey7, TValue> sparse8DMatrix) { m_dictionary.Clear(); // Copy each key value pair to the dictionary. foreach (KeyValuePair <ComparableTuple8 <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TKey6, TKey7>, TValue> pair in sparse8DMatrix) { ComparableTuple8 <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TKey6, TKey7> newCombinedKey = new ComparableTuple8 <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TKey6, TKey7>(pair.Key); m_dictionary.Add(newCombinedKey, pair.Value); } }
/// <summary> /// Method to copy the data in this Sparse8DMatrix instance to another instance. /// </summary> /// <param name="sparse8DMatrix">An instance of the Sparse8DMatrix class.</param> public void CopyTo(Sparse8DMatrix <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TKey6, TKey7, TValue> sparse8DMatrix) { sparse8DMatrix.m_dictionary.Clear(); // Copy each key value pair to the dictionary. foreach (KeyValuePair <ComparableTuple8 <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TKey6, TKey7>, TValue> pair in m_dictionary) { ComparableTuple8 <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TKey6, TKey7> newCombinedKey = new ComparableTuple8 <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TKey6, TKey7>(pair.Key); sparse8DMatrix.m_dictionary.Add(newCombinedKey, pair.Value); } }
/// <summary> /// Copy constructor. /// </summary> /// <param name="sparse8DMatrix">The sparse array instance to be copied</param> public Sparse8DMatrix(Sparse8DMatrix <TKey0, TKey1, TKey2, TKey3, TKey4, TKey5, TKey6, TKey7, TValue> sparse8DMatrix) { InitializeDictionary(); Initialize(sparse8DMatrix); DefaultValue = sparse8DMatrix.DefaultValue; }