Пример #1
0
 private void Copy(DDSketch other)
 {
     _store.Copy(other._store);
     Count = other.Count;
     Sum   = other.Sum;
     Min   = other.Min;
     Max   = other.Max;
 }
Пример #2
0
        public void Merge(DDSketch other)
        {
            Contract.Requires(Gamma == other.Gamma && _minimumRepresentableValue == other._minimumRepresentableValue,
                              "Sketches can only be merged if their gamma and minimum value are equal");

            if (other.Count == 0)
            {
                // Nothing to merge from the other sketch
                return;
            }

            if (Count == 0)
            {
                // Nothing to merge from this one, just replace everything.
                Copy(other);
                return;
            }

            _store.Merge(other._store);
            Count += other.Count;
            Sum   += other.Sum;
            Min    = Math.Min(Min, other.Min);
            Max    = Math.Max(Max, other.Max);
        }