// Merges new ranges to our own
199569
func (c *CharSet) addRanges(ranges []singleRange) {
	if c.anything {
		return
	}
	c.ranges = append(c.ranges, ranges...)
	c.canonicalize()
}
397296
func newRangeIterator(index *ShapeIndex) *rangeIterator {
	r := &rangeIterator{
		it: index.Iterator(),
	}
	r.refresh()
	return r
}
715000
func (c *Config) Merge(cfgs ...*Config) {
	for _, other := range cfgs {
		mergeConfig(c, other)
	}
}
994649
func (r *rangeIterator) refresh() {
	r.rangeMin = r.cellID().RangeMin()
	r.rangeMax = r.cellID().RangeMax()
}
140646
func (s *Set) Range(from, to interface{}) Iterator {
	return s.skiplist.Range(from, to)
}
947959
func (term Range) Overlaps(other Range) bool {
	return !term.Intersection(other).IsEmpty()
}
698587
func mergeMaps(m1, m2 map[string]interface{}) map[string]interface{} {
	for k, v := range m2 {
		if _, ok := m1[k]; !ok {
			m1[k] = v
		}
	}
	return m1
}
1331865
func (this *Parser) Range(start, end int) *OrderedChoice {
	exps := make([]Exp, (end - start)+1)
	for i := start; i <= end; i++ {
		exps[i-start] = &Terminal{this,i}
	}
	return &OrderedChoice{this,exps}
}
641803
func MergeSort(me []int, from, to int, tch chan<- int) {
	if from < to-1 {
		lch, rch := make(chan int), make(chan int)
		go MergeSort(me, from, (from+to)/2, lch)
		go MergeSort(me, (from+to)/2, to, rch)
		mergeCombine(lch, rch, tch)
	} else {
		for i := from; i < to; i++ {
			tch <- me[i]
		}
		close(tch)
	}
}
600322
func (db *DB) RangeLimitIterator(min []byte, max []byte, rangeType uint8, offset int, count int) *RangeLimitIterator {
	return NewRangeLimitIterator(db.NewIterator(), &Range{min, max, rangeType}, &Limit{offset, count})
}
28571
func (b *rangeBuilder) Range() (*Range, error) {
	if b.err != nil {
		return nil, b.err
	}
	if b.r.from != nil && b.r.to != nil && *b.r.to < *b.r.from {
		return nil, ErrInvalidRange
	}
	return &b.r, nil
}
94369
func (ia *IntervalAggregation) Merge(intAgg *IntervalAggregation) {
	ia.aggregationMaps.merge(&intAgg.aggregationMaps)

	for k, v := range intAgg.Jobs {
		if existingJob, ok := ia.Jobs[k]; ok {
			existingJob.merge(v)
		} else {
			ia.Jobs[k] = v.Clone()
		}
	}

	ia.SerialNumber++
}
1121141
func (td *MergingDigest) mergeAllTemps() {
	// this optimization is really important! if you remove it, the main list
	// will get merged into itself every time this is called
	if len(td.tempCentroids) == 0 {
		return
	}

	// we iterate over both centroid lists from least to greatest mean, so first
	// we have to sort this one
	sort.Sort(centroidList(td.tempCentroids))
	tempIndex := 0

	// total weight that the final t-digest will have, after everything is merged
	totalWeight := td.mainWeight + td.tempWeight
	// how much weight has been merged so far
	mergedWeight := 0.0
	// the index of the last quantile to be merged into the previous centroid
	// this value gets updated each time we split a new centroid out instead of
	// merging into the current one
	lastMergedIndex := 0.0
	// since we will be merging in-place into td.mainCentroids, we need to keep
	// track of the indices of the remaining elements
	actualMainCentroids := td.mainCentroids
	td.mainCentroids = td.mainCentroids[:0]
	// to facilitate the in-place merge, we will need a place to store the main
	// centroids that would be overwritten - we will use space from the start
	// of tempCentroids for this
	swappedCentroids := td.tempCentroids[:0]

	for len(actualMainCentroids)+len(swappedCentroids) != 0 || tempIndex < len(td.tempCentroids) {
		nextTemp := Centroid{
			Mean:   math.Inf(+1),
			Weight: 0,
		}
		if tempIndex < len(td.tempCentroids) {
			nextTemp = td.tempCentroids[tempIndex]
		}

		nextMain := Centroid{
			Mean:   math.Inf(+1),
			Weight: 0,
		}
		if len(swappedCentroids) != 0 {
			nextMain = swappedCentroids[0]
		} else if len(actualMainCentroids) != 0 {
			nextMain = actualMainCentroids[0]
		}

		if nextMain.Mean < nextTemp.Mean {
			if len(actualMainCentroids) != 0 {
				if len(swappedCentroids) != 0 {
					// if this came from swap, before merging, we have to save
					// the next main centroid at the end
					// this copy is probably the most expensive part of the
					// in-place merge, compared to merging into a separate buffer
					copy(swappedCentroids, swappedCentroids[1:])
					swappedCentroids[len(swappedCentroids)-1] = actualMainCentroids[0]
				}
				actualMainCentroids = actualMainCentroids[1:]
			} else {
				// the real main has been completely exhausted, so we're just
				// cleaning out swapped mains now
				swappedCentroids = swappedCentroids[1:]
			}

			lastMergedIndex = td.mergeOne(mergedWeight, totalWeight, lastMergedIndex, nextMain)
			mergedWeight += nextMain.Weight
		} else {
			// before merging, we have to save the next main centroid somewhere
			// else, so that we don't overwrite it
			if len(actualMainCentroids) != 0 {
				swappedCentroids = append(swappedCentroids, actualMainCentroids[0])
				actualMainCentroids = actualMainCentroids[1:]
			}
			tempIndex++

			lastMergedIndex = td.mergeOne(mergedWeight, totalWeight, lastMergedIndex, nextTemp)
			mergedWeight += nextTemp.Weight
		}
	}

	td.tempCentroids = td.tempCentroids[:0]
	td.tempWeight = 0
	td.mainWeight = totalWeight
}
429575
func (tr Ranges) addRangeInPlace(r Range) {
	if r.IsEmpty() {
		return
	}

	e := tr.findFirstNotBefore(r)
	for e != nil {
		lr := e.Value.(Range)
		ne := e.Next()
		if !lr.Overlaps(r) {
			break
		}
		r = r.Merge(lr)
		tr.sortedRanges.Remove(e)
		e = ne
	}
	if e == nil {
		tr.sortedRanges.PushBack(r)
		return
	}
	tr.sortedRanges.InsertBefore(r, e)
}
152626
func (ini *INI) Merge(from *INI, override bool) {
	for section, kv := range from.sections {
		for key, value := range kv {
			_, found := ini.SectionGet(section, key)
			if override || !found {
				ini.SectionSet(section, key, value)
			}
		}
	}
}
944716
func (m addrMap) Ranges(b32 string) (nets addrList) {
  ranges, ok := m[b32]
  if ok {
    for _, r := range ranges {
      _, cidr, err := net.ParseCIDR(r)
      if err == nil {
        nets = append(nets, cidr)
      }
    }
  } else {
    nets = nil
  }
  return
}
748317
func Range(start, end float64) []float64 {
	return Seq{NewLinear().WithStart(start).WithEnd(end).WithStep(1.0)}.Array()
}