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