Esempio n. 1
0
        public void SetKey(string Key, string Value)
        {
            if (Capacity <= 0)
            {
                return;
            }

            // If key does exist, we're returning from here
            if (Vals.ContainsKey(Key))
            {
                Vals.Add(Key, Value);
                GetKey(Key);
                return;
            }

            if (Vals.Count >= Capacity)
            {
                IEnumerator <string> enumerator = Lists[Minimum].GetEnumerator();
                if (enumerator.MoveNext())
                {
                    string evit = enumerator.Current;
                    Lists[Minimum].Remove(evit);
                    Vals.Remove(evit);
                    Counts.Remove(evit);
                }
                else
                {
                    throw new ArgumentOutOfRangeException("Invalid access at SetKey!");
                }
            }

            Console.WriteLine("Hereererre");

            // If the key is new, insert the value and current
            // min should be 1 of course
            if (!Vals.ContainsKey(Key))
            {
                Vals.Add(Key, Value);
            }

            if (!Counts.ContainsKey(Key))
            {
                Counts.Add(Key, 1);
            }
            Minimum = 1;
            if (!Lists.ContainsKey(Minimum))
            {
                Lists.Add(Minimum, new LinkedHashSet <string>());
            }
            else
            {
                Lists[Minimum].Add(Key);
            }
        }
Esempio n. 2
0
 public PokerHand(string hand)
 {
     Hand      = Hand.Trim();
     HighCards = new TupleList <string, int>();
     foreach (var Card in Hand)
     {
         if (Ranks.ContainsKey(Card))
         {
             Vals.Add(Ranks[Card]);
         }
     }
     foreach (var Card in Hand)
     {
         if (Suits.ContainsKey(Card))
         {
             Suits.Add(Suits[Card])
         }
     }
 }