// Split splits a Set into its domain, target, and ref components.
961613
func (cs Set) Split() (domain, target, ref string) {
	switch p := strings.SplitN(string(cs), "/", 3); len(p) {
	case 1:
		return p[0], "", ""
	case 2:
		return p[0], p[1], ""
	default:
		return p[0], p[1], p[2]
	}
}
164780
func (c *Cluster) SplitIndex(mvccStore MVCCStore, tableID, indexID int64, count int) {
	indexStart := tablecodec.EncodeTableIndexPrefix(tableID, indexID)
	indexEnd := indexStart.PrefixNext()
	c.splitRange(mvccStore, NewMvccKey(indexStart), NewMvccKey(indexEnd), count)
}
86632
func (s StringSet) Subset(t StringSet) bool {
	for k := range s {
		if _, ok := t[k]; !ok {
			return false
		}
	}
	return true
}
117474
func split(I, V, V2 []int, start, length, h int) {
	var i, j, k, x, jj, kk int

	// selection sort, for small buckets (don't split any further)
	if false && length < SelectionSortThreshold {
		for k = start; k < start+length; k += j {
			// the subarray [start:k] is already sorted
			j = 1
			// using the doubling technique from Karp, Miller, and Rosenberg,
			// V[I[i]+h] is our sorting key. See section 2.1 of
			// http://www.larsson.dogma.net/ssrev-tr.pdf
			x = V[I[k]+h]
			for i = 1; k+i < start+length; i++ {
				if V[I[k+i]+h] < x {
					// found a smaller value, x is the new smallest value
					x = V[I[k+i]+h]
					j = 0
				}
				if V[I[k+i]+h] == x {
					// since x is the smallest value we've seen so far, swap
					// the (k+i)th element next to it
					I[k+i], I[k+j] = I[k+j], I[k+i]
					// j is the number of values equal to the smallest value
					j++
				}
			}

			// at this point, x is the smallest value of the right part
			// of the array (the one we're still sorting) — and all values
			// equal to X are
			for i = 0; i < j; i++ {
				// commit group number for all values == x.
				// k + j -1 is a constant, they're all in the same group
				// (if j > 1, the group is not sorted yet).
				V2[I[k+i]] = k + j - 1
			}
			if j == 1 {
				// if there was only one value = x, it's a sorted group, mark
				// it as such in I (see faster suffix sorting)
				I[k] = -1
			}
		}
		return
	}

	// find pivot
	x = V[I[start+length/2]+h]
	jj = 0
	kk = 0
	for i = start; i < start+length; i++ {
		if V[I[i]+h] < x {
			// size of < bucket
			jj++
		}
		if V[I[i]+h] == x {
			// size of = bucket
			kk++
		}
	}
	// last index of < bucket
	jj += start
	// last index of = bucket
	kk += jj

	i = start
	j = 0
	k = 0
	// i goes from start of sorted array to end of < bucket
	for i < jj {
		if V[I[i]+h] < x {
			// ith element belongs in < bucket
			i++
		} else if V[I[i]+h] == x {
			// swap with = bucket
			I[i], I[jj+j] = I[jj+j], I[i]
			// j is our current position in the = bucket
			j++
		} else {
			// swap with > bucket
			I[i], I[kk+k] = I[kk+k], I[i]
			// k is our current position in the > bucket
			k++
		}
	}

	// at this point, the < bucket contains all < elements
	// but the = bucket might contain > elements, and vice versa
	for jj+j < kk {
		if V[I[jj+j]+h] == x {
			// (jj+j)th elements really belongs in =
			j++
		} else {
			// swap with > bucket
			I[jj+j], I[kk+k] = I[kk+k], I[jj+j]
			k++
		}
	}

	// at this point, the < bucket contains
	// all values < x, unsorted. same goes
	// for = and > buckets

	if jj > start {
		// < bucket is not empty, sort it
		split(I, V, V2, start, jj-start, h)
	}

	for i = 0; i < kk-jj; i++ {
		// commit ordering of = bucket
		// note that `kk - 1` is constant: all = elements have
		// the same group number, see Definition 3
		// in http://www.larsson.dogma.net/ssrev-tr.pdf
		V2[I[jj+i]] = kk - 1
	}
	if jj == kk-1 {
		// if = bucket is empty, that means we've
		// sorted the group (no need for further subsorts)
		I[jj] = -1
	}

	if start+length > kk {
		// > bucket is not empty, sort it
		split(I, V, V2, kk, start+length-kk, h)
	}
}
1212191
func Split(name, segment string) ([]string, error) {
	parts := []string{segment}

	if len(segment) == 0 {
		return parts, nil // let elsewhere handle the empty single segment
	}

	if segment[0] == '[' && segment[len(segment)-1] == ']' {
		parts = strings.Split(segment[1:len(segment)-1], "|")
		// zero length is checked in parseMultiple
		if len(parts) == 1 {
			return nil, errors.New("Single item in segment alternation for " + name + ".")
		}
	}

	return parts, nil
}
623051
func Separate(s string, sep byte) (string, string) {
	i := MidIndex(s, sep)
	if i < 0 {
		return "", ""
	}

	return s[:i], s[i+1:]
}
89770
func (c Context) Split(s string, sep string) []string {
	return strings.Split(s, sep)
}
1240421
func split255(s string) []string {
	if len(s) < 255 {
		return []string{s}
	}
	sx := []string{}
	p, i := 0, 255
	for {
		if i <= len(s) {
			sx = append(sx, s[p:i])
		} else {
			sx = append(sx, s[p:])
			break

		}
		p, i = p+255, i+255
	}

	return sx
}
639610
func (n *node) split(pageSize int) []*node {
	var nodes []*node

	node := n
	for {
		// Split node into two.
		a, b := node.splitTwo(pageSize)
		nodes = append(nodes, a)

		// If we can't split then exit the loop.
		if b == nil {
			break
		}

		// Set node to b so it gets split on the next iteration.
		node = b
	}

	return nodes
}
1359850
func split(args, fields []string) []string {
	for _, arg := range fields {
		arr := strings.Fields(arg)
		args = append(args, arr...)
	}
	return args
}
1188988
func splitCombine(inStrs []string) []string {
	outStrs := make([]string, 0)
	for _, str := range inStrs {
		inStrs := strings.Fields(str)
		outStrs = append(outStrs, inStrs...)
	}
	return outStrs
}
1293655
func splitSpecial(s string, delimiter string, cutdelimiter bool) (string, string) {
	i := strings.Index(s, delimiter)
	if i < 0 {
		// if delimiter not found return as is.
		return s, ""
	}
	// if delimiter should be removed, remove it.
	if cutdelimiter {
		return s[0:i], s[i+len(delimiter):]
	}
	// return split strings with delimiter
	return s[0:i], s[i:]
}
290710
func (set RuleSet) Slice() []Rule {
	var out []Rule
	for _, rules := range set {
		out = append(out, rules...)
	}
	return out
}
664237
func SplitAt(args []string, sep string) ([]string, []string) {
	index := -1
	for i, a := range args {
		if a == sep {
			index = i
			break
		}
	}
	if index == -1 {
		return args, []string{}
	}
	return args[:index], args[index+1:]
}
558346
func SplitString(b []byte) (content, rest []byte, err error) {
	k, content, rest, err := Split(b)
	if err != nil {
		return nil, b, err
	}
	if k == List {
		return nil, b, ErrExpectedString
	}
	return content, rest, nil
}
530237
func (tableNode *routingTableNode) Split() {
	prefixLen := tableNode.KBucket().prefix.Size

	if prefixLen == maxPrefixLength {
		return
	}

	for i := 0; i < 2; i++ {
		tableNode.SetChild(i, newRoutingTableNode(newBitmapFrom(
			tableNode.KBucket().prefix, prefixLen+1)))
	}

	tableNode.Lock()
	tableNode.children[1].bucket.prefix.Set(prefixLen)
	tableNode.Unlock()

	for e := range tableNode.KBucket().nodes.Iter() {
		nd := e.Value.(*node)
		tableNode.Child(nd.id.Bit(prefixLen)).KBucket().nodes.PushBack(nd)
	}

	for e := range tableNode.KBucket().candidates.Iter() {
		nd := e.Value.(*node)
		tableNode.Child(nd.id.Bit(prefixLen)).KBucket().candidates.PushBack(nd)
	}

	for i := 0; i < 2; i++ {
		tableNode.Child(i).KBucket().UpdateTimestamp()
	}
}
691147
func (q *quantizer) split(s, c *cluster, m uint32) {
	*c = *s // copy extent data
	px := s.px
	var v uint32
	i := 0
	last := len(px) - 1
	for i <= last {
		// Get color value in appropriate dimension.
		r, g, b, _ := q.pxRGBA(int(px[i].x), int(px[i].y))
		switch s.widestCh {
		case rgbR:
			v = r
		case rgbG:
			v = g
		case rgbB:
			v = b
		}
		// Split at m.
		if v < m {
			i++
		} else {
			px[last], px[i] = px[i], px[last]
			last--
		}
	}
	// Split the pixel list.  s keeps smaller values, c gets larger values.
	s.px = px[:i]
	c.px = px[i:]
	// Split color extent
	n := s.node
	switch s.widestCh {
	case rgbR:
		s.maxR = m
		c.minR = m
		s.bMaxR = false
		c.bMinR = false
		n.Type = quant.TSplitR
	case rgbG:
		s.maxG = m
		c.minG = m
		s.bMaxG = false
		c.bMinG = false
		n.Type = quant.TSplitG
	case rgbB:
		s.maxB = m
		c.minB = m
		s.bMaxB = false
		c.bMinB = false
		n.Type = quant.TSplitB
	}
	// Split node
	n.Split = m
	n.Low = &quant.Node{}
	n.High = &quant.Node{}
	s.node, c.node = n.Low, n.High
}