Beispiel #1
0
        public void Increment(T key)
        {
            MutableInteger count = get(key);

            if (count == null)
            {
                MutableInteger newCount = new MutableInteger();
                newCount.Value = 1;
                counts.Add(key, newCount);
            }
            else
            {
                count.Increment();
            }
        }
Beispiel #2
0
        public int this[T key]
        {
            get
            {
                return(GetCount(key));
            }

            set
            {
                MutableInteger mi = get(key);
                if (mi == null)
                {
                    mi = new MutableInteger();
                    counts.Add(key, mi);
                }
                ;
                mi.Value = value;
            }
        }
Beispiel #3
0
        public int GetCount(T key)
        {
            MutableInteger count = get(key);

            return(count == null ? 0 : count.Value);
        }