Пример #1
0
 public void Add(T item)
 {
     lock (popularLock)
     {
         if (!resultCount.ContainsKey(item))
         {
             Monitor.Pulse(popularLock);
             resultCount[item] = 1;
             countSet.Add(Tuple.Create(1, item));
         }
         else
         {
             var oldCount = resultCount[item];
             countSet.Remove(Tuple.Create(oldCount, item));
             countSet.Add(Tuple.Create(oldCount + 1, item));
             resultCount[item]++;
         }
     }
 }
Пример #2
0
        public void Add(TIn item)
        {
            var result = selector(item);

            lock (minMaxLock)
            {
                if (!resultCounter.ContainsKey(result))
                {
                    Monitor.Pulse(minMaxLock);
                    resultCounter[result] = 1;
                    resultSet.Add(result);
                }
                else
                {
                    resultCounter[result] += 1;
                }
            }
            UpdateValue();
        }
Пример #3
0
 public void Add(T item)
 {
     values.Add(item);
 }