/// <summary> /// Return a map that can be used to store reduced values, creating it if /// one has not already been created. /// </summary> /// <returns> /// A set that can be used to store distinct values. /// </returns> protected IDictionary EnsureMap() { IDictionary map = m_map; if (map == null) { map = m_map = new LiteDictionary(); } return(map); }
/// <summary> /// Process a collection of <see cref="IInvocableCacheEntry"/> /// objects. /// </summary> /// <param name="entries"> /// A read-only collection of <b>IInvocableCacheEntry</b> /// objects to process. /// </param> /// <returns> /// A dictionary containing the results of the processing, up to one /// entry for each <b>IInvocableCacheEntry</b> that was /// processed, keyed by the keys of the dictionary that were /// processed, with a corresponding value being the result of the /// processing for each key. /// </returns> public override IDictionary ProcessAll(ICollection entries) { IDictionary results = new LiteDictionary(); IFilter filter = m_filter; foreach (IInvocableCacheEntry entry in entries) { if (InvocableCacheHelper.EvaluateEntry(filter, entry)) { results[entry.Key] = Process(entry); } } return(results); }
/// <summary> /// Process a collection of <see cref="IInvocableCacheEntry"/> /// objects. /// </summary> /// <param name="entries"> /// A read-only collection of <b>IInvocableCacheEntry</b> /// objects to process. /// </param> /// <returns> /// A dictionary containing the results of the processing, up to one /// entry for each <b>IInvocableCacheEntry</b> that was /// processed, keyed by the keys of the dictionary that were /// processed, with a corresponding value being the result of the /// processing for each key. /// </returns> public override IDictionary ProcessAll(ICollection entries) { IDictionary results = new LiteDictionary(); IVersionable value = m_value; bool insert = m_insert; bool ret = m_return; foreach (IInvocableCacheEntry entry in entries) { object result = processEntry(entry, value, insert, ret); if (result != NO_RESULT) { results[entry.Key] = result; } } return(results); }
/// <summary> /// Process a collection of <see cref="IInvocableCacheEntry"/> /// objects. /// </summary> /// <param name="entries"> /// A read-only collection of <b>IInvocableCacheEntry</b> /// objects to process. /// </param> /// <returns> /// A dictionary containing the results of the processing, up to one /// entry for each <b>IInvocableCacheEntry</b> that was /// processed, keyed by the keys of the dictionary that were /// processed, with a corresponding value being the result of the /// processing for each key. /// </returns> public override IDictionary ProcessAll(ICollection entries) { IDictionary results = new LiteDictionary(); IFilter filter = m_filter; foreach (IInvocableCacheEntry entry in entries) { if (entry.IsPresent && InvocableCacheHelper.EvaluateEntry(filter, entry)) { entry.Remove(false); } else if (m_return) { results[entry.Key] = entry.Value; } } return(results); }
/// <summary> /// Process a collection of <see cref="IInvocableCacheEntry"/> /// objects. /// </summary> /// <param name="entries"> /// A read-only collection of <b>IInvocableCacheEntry</b> /// objects to process. /// </param> /// <returns> /// A dictionary containing the results of the processing, up to one /// entry for each <b>IInvocableCacheEntry</b> that was /// processed, keyed by the keys of the dictionary that were /// processed, with a corresponding value being the result of the /// processing for each key. /// </returns> public override IDictionary ProcessAll(ICollection entries) { IDictionary results = new LiteDictionary(); IFilter filter = m_filter; object value = m_value; bool ret = m_return; foreach (IInvocableCacheEntry entry in entries) { if (InvocableCacheHelper.EvaluateEntry(filter, entry)) { entry.SetValue(value, false); } else if (ret) { results[entry.Key] = entry.Value; } } return(results); }