public void Cleanup() { multiDict = null; mirrorDict = null; queryMap1 = null; queryMap2 = null; }
public VirtualMultiKeyMap(IMultiKeyMap <T2, K2, V> source, Func <T2, T1> subKeySelector1, Func <T1, T2> subKeySelector2, Func <K2, K1> keySelector1, Func <K1, K2> keySelector2) : base(source, subKeySelector1, subKeySelector2, keySelector1, keySelector2, ValueIdentity, ValueIdentity) { }
public static IMultiKeyMap <T1, K1, V> ToMultiKeyMapWrapper <T1, T2, K1, K2, V>( this IMultiKeyMap <T2, K2, V> source, Func <T2, T1> subKeySelector1, Func <T1, T2> subKeySelector2, Func <K2, K1> keySelector1, Func <K1, K2> keySelector2) where K1 : class, IEnumerable <T1> where K2 : class, IEnumerable <T2> { return(new VirtualMultiKeyMap <T1, T2, K1, K2, V>(source, subKeySelector1, subKeySelector2, keySelector1, keySelector2)); }
/// <summary> /// Copies (adds) all KeyValuePair(-s) from the other IMultiKeyMap into this object. /// NOTE: The keys and values are not cloned, but just simply added as-is. /// </summary> /// <typeparam name="T">The type of sub-keys to query by and compose the full keys of</typeparam> /// <typeparam name="K">The type of the composite keys comprising some enumerable of sub-keys of type T</typeparam> /// <typeparam name="V">The type of values in the dictionary</typeparam> /// <param name="me">this object</param> /// <param name="other">the source of the data to copy from</param> /// <returns></returns> public static IMultiKeyMap <T, K, V> CopyFrom <T, K, V>(this IMultiKeyMap <T, K, V> me, IDictionary <K, V> other) where K : class, IEnumerable <T> { other = other ?? throw new ArgumentNullException(); foreach (var entry in other) { me.Add(entry.Key, entry.Value); } return(me); }
/// <summary> /// Gets all values for which their full keys contain the partial key set in any order. /// </summary> /// <param name="partialKey">The combination of the sub-keys to search for, wherein each sub-key is a Tuple of the position and the sub-key itself. /// The negative position signifies non-positional sub-key to search anywhere within the full key, otherwise, its exact position within the full key. /// </param> /// <param name="values">A non-live non-empty sequence of the values satisfying the partial key criteria, or the default value of the result /// type if not found.</param> /// <param name="me">this object</param> /// <returns>true if the partial key is found, false otherwise.</returns> public static bool TryGetValuesByPartialKey <T, K, V>(this IMultiKeyMap <T, K, V> me, IEnumerable <(int position, T subkey)> partialKey,
public void Init(K[] keys, V[] values, Func <IMultiKeyMap <T, K, V> > supplier = null) { supplier = supplier ?? Supplier; queryMap1 = TestHelpers.CreateMultiKeyMap(keys, values, supplier); queryMap2 = TestHelpers.CreateMultiKeyMap(keys, values, supplier); }
public void Init(Func <IMultiKeyMap <T, K, V> > supplier = null) { multiDict = (supplier ?? Supplier).Invoke(); mirrorDict = new Dictionary <K, V>(); }