Пример #1
0
 /// <summary>
 /// <inheritDoc/>
 ///
 /// </summary>
 public virtual void SetCount(E key, double count)
 {
     if (tempMDouble == null)
     {
         //System.out.println("creating mdouble");
         tempMDouble = new MutableDouble();
     }
     //System.out.println("setting mdouble");
     tempMDouble.Set(count);
     //System.out.println("putting mdouble in map");
     tempMDouble = map[key] = tempMDouble;
     //System.out.println("placed mDouble in map");
     totalCount += count;
     if (tempMDouble != null)
     {
         totalCount -= tempMDouble;
     }
 }
Пример #2
0
        /// <summary>
        /// Equivalent to <code>
        /// <see cref="GeneralizedCounter{K}.IncrementCount(System.Collections.IList{E})"/>
        /// ({o}, count)</code>;
        /// only works for a depth 1 GeneralizedCounter.
        /// </summary>
        public virtual void IncrementCount1D(K o, double count)
        {
            if (depth > 1)
            {
                WrongDepth();
            }
            AddToTotal(count);
            if (tempMDouble == null)
            {
                tempMDouble = new MutableDouble();
            }
            tempMDouble.Set(count);
            MutableDouble oldMDouble = (MutableDouble)map[o] = tempMDouble;

            if (oldMDouble != null)
            {
                tempMDouble.Set(count + oldMDouble);
            }
            tempMDouble = oldMDouble;
        }