// Combine merges the values seen with another set (marshalled as a byte slice)
336570
func (s *Set) Combine(other []byte) error {
	otherHLL := hyperloglog.New()
	if err := otherHLL.UnmarshalBinary(other); err != nil {
		return err
	}
	if err := s.Hll.Merge(otherHLL); err != nil {
		// does not error unless compressions are different
		// however, decoding the other Hll causes us to use its compression
		// parameter, which might be different from ours
		return err
	}
	return nil
}
323139
func (pc ParseContext) Merge(o ParseContext) {
	for k, vs := range o.Args {
		pc.Args[k] = append(pc.Args[k], vs...)
	}

	for k, vs := range o.Opts {
		pc.Opts[k] = append(pc.Opts[k], vs...)
	}
}
611109
func (b *rescanBatch) merge(job *RescanJob) {
	if job.InitialSync {
		b.initialSync = true
	}
	b.addrs = append(b.addrs, job.Addrs...)

	for op, addr := range job.OutPoints {
		b.outpoints[op] = addr
	}

	if job.BlockStamp.Height < b.bs.Height {
		b.bs = job.BlockStamp
	}
	b.errChans = append(b.errChans, job.err)
}
1229721
func (filters identityFilters) combine() identityFilter {
	return func(identity api.PeerIdentityType) bool {
		for _, f := range filters {
			if !f(identity) {
				return false
			}
		}
		return true
	}
}
570662
func (h *Histogram) Merge(from *Histogram) (dropped int64) {
	i := from.rIterator()
	for i.next() {
		v := i.valueFromIdx
		c := i.countAtIdx

		if h.RecordValues(v, c) != nil {
			dropped += c
		}
	}

	return
}
610180
func (s *StatusCheck) Combine(other []byte) error {
	var otherValue float64
	buf := bytes.NewReader(other)
	err := binary.Read(buf, binary.LittleEndian, &otherValue)

	if err != nil {
		return err
	}

	s.Value = otherValue

	return nil
}
312786
func (h *Histogram) Merge(h2 *Histogram) {
	if h.opts != h2.opts {
		log.Fatalf("failed to merge histograms, created by inequivalent options")
	}
	h.Count += h2.Count
	h.Sum += h2.Sum
	h.SumOfSquares += h2.SumOfSquares
	if h2.Min < h.Min {
		h.Min = h2.Min
	}
	if h2.Max > h.Max {
		h.Max = h2.Max
	}
	for i, b := range h2.Buckets {
		h.Buckets[i].Count += b.Count
	}
}
468883
func (m *MinWise) Merge(m2 *MinWise) {

	for i, v := range m2.minimums {

		if v < m.minimums[i] {
			m.minimums[i] = v
		}
	}
}
1322853
func (c *Config) Merge(other *Config) (changed bool) {
	return c.values.Merge(nil, other.values)
}
391433
func merge(mapA, mapB map[string]interface{}) map[string]interface{} {
	result := make(map[string]interface{})
	for k, v := range mapA {
		result[k] = v
	}
	for k, v := range mapB {
		if _, ok := result[k]; !ok || result[k] == nil || result[k] == false {
			result[k] = v
		}
	}
	return result
}
1277163
func Merge(w io.Writer, opts *BuilderOpts, itrs []Iterator, f MergeFunc) error {
	builder, err := New(w, opts)
	if err != nil {
		return err
	}

	itr, err := NewMergeIterator(itrs, f)
	for err == nil {
		k, v := itr.Current()
		err = builder.Insert(k, v)
		if err != nil {
			return err
		}
		err = itr.Next()
	}

	if err != nil && err != ErrIteratorDone {
		return err
	}

	err = itr.Close()
	if err != nil {
		return err
	}

	err = builder.Close()
	if err != nil {
		return err
	}

	return nil
}
1043245
func (r *RawConfig) Merge(other *RawConfig) *RawConfig {
	r.lock.Lock()
	defer r.lock.Unlock()

	// Merge the raw configurations
	raw := make(map[string]interface{})
	for k, v := range r.Raw {
		raw[k] = v
	}
	for k, v := range other.Raw {
		raw[k] = v
	}

	// Create the result
	result, err := NewRawConfig(raw)
	if err != nil {
		panic(err)
	}

	// Merge the interpolated results
	result.config = make(map[string]interface{})
	for k, v := range r.config {
		result.config[k] = v
	}
	for k, v := range other.config {
		result.config[k] = v
	}

	// Build the unknown keys
	if len(r.unknownKeys) > 0 || len(other.unknownKeys) > 0 {
		unknownKeys := make(map[string]struct{})
		for _, k := range r.unknownKeys {
			unknownKeys[k] = struct{}{}
		}
		for _, k := range other.unknownKeys {
			unknownKeys[k] = struct{}{}
		}

		result.unknownKeys = make([]string, 0, len(unknownKeys))
		for k, _ := range unknownKeys {
			result.unknownKeys = append(result.unknownKeys, k)
		}
	}

	return result
}
1243171
func (c *CountMinSketch) Merge(other *CountMinSketch) error {
	if c.depth != other.depth {
		return errors.New("matrix depth must match")
	}

	if c.width != other.width {
		return errors.New("matrix width must match")
	}

	for i := uint(0); i < c.depth; i++ {
		for j := uint(0); j < c.width; j++ {
			c.matrix[i][j] += other.matrix[i][j]
		}
	}

	c.count += other.count
	return nil
}
441703
func (s *set) Merge(t Interface) {
	t.Each(func(item interface{}) bool {
		s.m[item] = keyExists
		return true
	})
}
259967
func combine(x string, xs []string) []string {
	if x == "" {
		return xs
	}

	n := len(xs) + 1
	ns := make([]string, n)

	ns[0] = x
	for i := 1; i < n; i++ {
		ns[i] = xs[i-1]
	}
	return ns
}
958126
func (c *Counter) Combine(other []byte) error {
	var otherCounts int64
	buf := bytes.NewReader(other)
	err := binary.Read(buf, binary.LittleEndian, &otherCounts)

	if err != nil {
		return err
	}

	c.value += otherCounts

	return nil
}
541240
func (s *Summary) merge(o *Summary) {
	if o.TimeElapsed > s.TimeElapsed {
		s.TimeElapsed = o.TimeElapsed
	}
	s.SuccessHistogram.Merge(o.SuccessHistogram)
	s.UncorrectedSuccessHistogram.Merge(o.UncorrectedSuccessHistogram)
	s.ErrorHistogram.Merge(o.ErrorHistogram)
	s.UncorrectedErrorHistogram.Merge(o.UncorrectedErrorHistogram)
	s.SuccessTotal += o.SuccessTotal
	s.ErrorTotal += o.ErrorTotal
	s.Throughput += o.Throughput
	s.RequestRate += o.RequestRate
}