Exemple #1
0
        internal static KeyValuePair <K, V> ConvertToManaged <K, V>(IntPtr pInsp)
        {
            object obj = InterfaceMarshaler.ConvertToManagedWithoutUnboxing(pInsp);
            IKeyValuePair <K, V> keyValuePair = (IKeyValuePair <K, V>)obj;

            return(new KeyValuePair <K, V>(keyValuePair.Key, keyValuePair.Value));
        }
Exemple #2
0
        public void SetValue(int hash, IKeyValuePair <TKey, TValue> pair)
        {
            int index = hash % Count;

            //Normally just add one more collision
            if (!_isSubNodesOn)
            {
                if (_innerArray[index] == null)
                {
                    _innerArray[index] = new ValueCell <TKey, TValue>();
                }
            }
            //But if node it too large - rebuild asked cell to NodeCell (and add one more node)
            else
            {
                if (_innerArray[index] == null)
                {
                    _innerArray[index] = new NodeCell <TKey, TValue>(new Node <TKey, TValue>(
                                                                         _balancer.GetNewNodeSize(_level + 1),
                                                                         _level + 1,
                                                                         _balancer));
                }
            }

            var cell = _innerArray[index];

            cell.Add(hash, pair);

            ElementCount++;
        }
        // Token: 0x060062B4 RID: 25268 RVA: 0x0014FF4C File Offset: 0x0014E14C
        private KeyValuePair <TKey, TValue>[] CreateKeyValueArray(int count, IEnumerator <IKeyValuePair <TKey, TValue> > data)
        {
            KeyValuePair <TKey, TValue>[] array = new KeyValuePair <TKey, TValue> [count];
            int num = 0;

            while (data.MoveNext())
            {
                IKeyValuePair <TKey, TValue> keyValuePair = data.Current;
                array[num++] = new KeyValuePair <TKey, TValue>(keyValuePair.Key, keyValuePair.Value);
            }
            Array.Sort <KeyValuePair <TKey, TValue> >(array, ConstantSplittableMap <TKey, TValue> .keyValuePairComparator);
            return(array);
        }
 protected void ChildStatsAppender(StringBuilder sb, IKeyValuePair<string, ChildStats> kvp, int index)
 {
     sb.Append('<');
     var childStats = kvp.Value;
     var childRestartStats = childStats as ChildRestartStats;
     if (childRestartStats != null)
     {
         sb.Append(childRestartStats.Child.Path.ToStringWithUid()).Append(':');
         sb.Append(childRestartStats.MaxNrOfRetriesCount).Append(" retries>");
     }
     else
     {
         sb.Append(kvp.Key).Append(":").Append(childStats).Append('>');
     }
 }
        private KeyValuePair <TKey, TValue>[] CreateKeyValueArray(Int32 count, IEnumerator <IKeyValuePair <TKey, TValue> > data)
        {
            KeyValuePair <TKey, TValue>[] kvArray = new KeyValuePair <TKey, TValue> [count];

            Int32 i = 0;

            while (data.MoveNext())
            {
                IKeyValuePair <TKey, TValue> current = data.Current;
                kvArray[i++] = new KeyValuePair <TKey, TValue>(current.Key, current.Value);
            }

            Array.Sort(kvArray, keyValuePairComparator);

            return(kvArray);
        }
 /// <summary>
 /// Gets or sets the element with the specified key.
 /// </summary>
 /// <returns>
 /// The element with the specified key.
 /// </returns>
 /// <param name="key">The key of the element to get or set.
 ///                 </param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> is null.
 ///                 </exception><exception cref="T:System.Collections.Generic.KeyNotFoundException">The property is retrieved and <paramref name="key"/> is not found.
 ///                 </exception><exception cref="T:System.NotSupportedException">The property is set and the <see cref="T:System.Collections.Generic.IDictionary`2"/> is read-only.
 ///                 </exception>
 public object this[string key]
 {
     get { return(AsString(findKVP(key).Value)); }
     set
     {
         IKeyValuePair <string, object> exists = findKVP(key);
         if (exists != null)
         {
             exists.Value = value;
             return;
         }
         exists = this.makeKV(key);
         ListKeyValue.Add(exists);
         exists.Value = value;
     }
 }
Exemple #7
0
        protected void ChildStatsAppender(StringBuilder sb, IKeyValuePair <string, ChildStats> kvp, int index)
        {
            sb.Append('<');
            var childStats        = kvp.Value;
            var childRestartStats = childStats as ChildRestartStats;

            if (childRestartStats != null)
            {
                sb.Append(childRestartStats.Child.Path.ToStringWithUid()).Append(':');
                sb.Append(childRestartStats.MaxNrOfRetriesCount).Append(" retries>");
            }
            else
            {
                sb.Append(kvp.Key).Append(":").Append(childStats).Append('>');
            }
        }
 public void SysVarHtml(OutputDelegate writeIt, bool noReadOnly)
 {
     writeIt("<table><tr><th>Variable Name</th><th>current value</th><th>Description</th></tr>");
     foreach (var sv in GetSysVars())
     {
         IKeyValuePair <string, object> svv = sv;
         var t = (svv.Value ?? svv.Key).GetType().Name;
         if (noReadOnly && svv.IsReadOnly)
         {
             continue;
         }
         writeIt(string.Format("<tr name=\"{0}\" id='{0}'><td>{0}</td><td>{1}</td><td>{2}</td></tr>",
                               Htmlize.NoEnts(svv.Key), Htmlize.NoEnts("" + svv.Value),
                               Htmlize.NoEnts(svv.Comments)));
     }
     writeIt("</table>");
 }
Exemple #9
0
        private int CompareMostAccidentProneKvps(IKeyValuePair x, IKeyValuePair y)
        {
            if (x == null)
            {
                throw new ArgumentNullException(nameof(x));
            }
            if (y == null)
            {
                throw new ArgumentNullException(nameof(y));
            }

            var mostAccidentProneKvp1 = x as MostAccidentProneKvp;

            if (mostAccidentProneKvp1 == null)
            {
                throw new ArgumentNullException(nameof(mostAccidentProneKvp1));
            }

            var mostAccidentProneKvp2 = y as MostAccidentProneKvp;

            if (mostAccidentProneKvp2 == null)
            {
                throw new ArgumentNullException(nameof(mostAccidentProneKvp2));
            }

            if (mostAccidentProneKvp1.Value == null)
            {
                throw new ArgumentNullException($"{nameof(mostAccidentProneKvp1)}.{nameof(mostAccidentProneKvp1.Value)}");
            }
            if (mostAccidentProneKvp2.Value == null)
            {
                throw new ArgumentNullException($"{nameof(mostAccidentProneKvp2)}.{nameof(mostAccidentProneKvp2.Value)}");
            }

            return(mostAccidentProneKvp2.Value.RegistrationsPerAccident.CompareTo(
                       mostAccidentProneKvp1.Value.RegistrationsPerAccident));
        }
Exemple #10
0
 public void Add(int hash, IKeyValuePair <TKey, TValue> pair)
 {
     FirstCollision = new CollisionItem <TKey, TValue>(pair, FirstCollision);
 }
        public IReadOnlyCollection <string> FinalReduce(IKeyValuePair keyValuePair)
        {
            var mostAccidentProne = (MostAccidentProneKvp)keyValuePair;

            return(new[] { $"{mostAccidentProne.Key},{mostAccidentProne.Value.NoOfCarsRegistered},{mostAccidentProne.Value.NoOfAccidents},{mostAccidentProne.Value.RegistrationsPerAccident:0.0}" });
        }
Exemple #12
0
 public bool Equals(IKeyValuePair <WeatherEventType, WeatherEventData> other)
 {
     return(Key.Equals(other.Key));
 }
Exemple #13
0
        public CollisionItem(IKeyValuePair <TKey, TValue> pair)
        {
            Debug.Assert(pair != null);

            Pair = pair;
        }
Exemple #14
0
 public DerivedService(IKeyValuePair <CustomList, string> p1) : base(p1)
 {
 }
Exemple #15
0
 public static KeyValuePair <TK, TV> ToKeyValuePair <TK, TV>(this IKeyValuePair <TK, TV> kv)
 {
     return(new KeyValuePair <TK, TV>(kv.Key, kv.Value));
 }
Exemple #16
0
        public IReadOnlyCollection <string> FinalReduce(IKeyValuePair keyValuePair)
        {
            var countKvp = (CountKvp)keyValuePair;

            return(new[] { $"{countKvp.Key},{countKvp.Value}" });
        }
Exemple #17
0
 public void Add(int hash, IKeyValuePair <TKey, TValue> pair)
 {
     NextNode.SetValue(hash, pair);
 }
Exemple #18
0
 public BaseService(IKeyValuePair <List <string>, string> p1)
 {
 }
Exemple #19
0
 public CollisionItem(IKeyValuePair <TKey, TValue> pair, CollisionItem <TKey, TValue> previous)
     : this(pair)
 {
     previous.Next = this;
 }