// Insert adds a subscription into the sublist
347634
func (s *Sublist) Insert(subject string, element interface{}) error {
	tsa := [32]string{}
	tokens := tsa[:0]
	start := 0
	for i := 0; i < len(subject); i++ {
		if subject[i] == btsep {
			tokens = append(tokens, subject[start:i])
			start = i + 1
		}
	}
	tokens = append(tokens, subject[start:])

	s.Lock()

	sfwc := false
	l := s.root
	var n *node

	for _, t := range tokens {
		if len(t) == 0 || sfwc {
			s.Unlock()
			return ErrInvalidSubject
		}

		switch t[0] {
		case pwc:
			n = l.pwc
		case fwc:
			n = l.fwc
			sfwc = true
		default:
			n = l.nodes[t]
		}
		if n == nil {
			n = newNode()
			switch t[0] {
			case pwc:
				l.pwc = n
			case fwc:
				l.fwc = n
			default:
				l.nodes[t] = n
			}
		}
		if n.next == nil {
			n.next = newLevel()
		}
		l = n.next
	}
	n.elements = append(n.elements, element)
	s.addToCache(subject, element)
	s.count++
	s.Unlock()
	return nil
}
1142597
func (trie *Trie) Insert(key Prefix, item Item) (inserted bool) {
	return trie.put(key, item, false)
}
1138508
func (xft *XFastTrie) Insert(entries ...Entry) {
	for _, e := range entries {
		xft.insert(e)
	}
}
943635
func (t *IntTree) Insert(e IntInterface, fast bool) (err error) {
	if r := e.Range(); r.Start > r.End {
		return ErrInvertedRange
	}
	var d int
	t.Root, d = t.Root.insert(e, e.Range(), e.ID(), fast)
	t.Count += d
	t.Root.Color = llrb.Black
	return
}
1146604
func (l *PacketIntervalList) insert(e, at *PacketIntervalElement) *PacketIntervalElement {
	n := at.next
	at.next = e
	e.prev = at
	e.next = n
	n.prev = e
	e.list = l
	l.len++
	return e
}
73477
func (e *Elem) Insert(rr dns.RR) {
	t := rr.Header().Rrtype
	if e.m == nil {
		e.m = make(map[uint16][]dns.RR)
		e.m[t] = []dns.RR{rr}
		return
	}
	rrs, ok := e.m[t]
	if !ok {
		e.m[t] = []dns.RR{rr}
		return
	}
	for _, er := range rrs {
		if equalRdata(er, rr) {
			return
		}
	}

	rrs = append(rrs, rr)
	e.m[t] = rrs
}
1017902
func (s IntSet) Insert(items ...int) {
	for _, item := range items {
		s[item] = sets.Empty{}
	}
}
504560
func (a Account) Insert() (int, error) {
	accountMaxID++
	a.ID = accountMaxID
	a.Name = fmt.Sprintf("account_%d", accountMaxID)
	accounts = append(accounts, a)
	return accountMaxID, nil
}
55845
func list_insert(fnname string, recv_ Value, args Tuple, kwargs []Tuple) (Value, error) {
	recv := recv_.(*List)
	var index int
	var object Value
	if err := UnpackPositionalArgs(fnname, args, kwargs, 2, &index, &object); err != nil {
		return nil, err
	}
	if err := recv.checkMutable("insert into", true); err != nil {
		return nil, err
	}

	if index < 0 {
		index += recv.Len()
	}

	if index >= recv.Len() {
		// end
		recv.elems = append(recv.elems, object)
	} else {
		if index < 0 {
			index = 0 // start
		}
		recv.elems = append(recv.elems, nil)
		copy(recv.elems[index+1:], recv.elems[index:]) // slide up one
		recv.elems[index] = object
	}
	return None, nil
}
1180263
func (b *Builder) Insert(key []byte, val uint64) error {
	// ensure items are added in lexicographic order
	if bytes.Compare(key, b.last) < 0 {
		return ErrOutOfOrder
	}
	if len(key) == 0 {
		b.len = 1
		b.unfinished.setRootOutput(val)
		return nil
	}

	prefixLen, out := b.unfinished.findCommonPrefixAndSetOutput(key, val)
	b.len++
	err := b.compileFrom(prefixLen)
	if err != nil {
		return err
	}
	b.copyLastKey(key)
	b.unfinished.addSuffix(key[prefixLen:], out)

	return nil
}
1288578
func (journal *txJournal) insert(tx *types.Transaction) error {
	if journal.writer == nil {
		return errNoActiveJournal
	}
	if err := rlp.Encode(journal.writer, tx); err != nil {
		return err
	}
	return nil
}
606004
func (c *C) Insert(o []byte) error {
	c.m.Lock()
	defer c.m.Unlock()
	f, err := c.file()
	if err != nil {
		return err
	}
	f.Seek(0, os.SEEK_END)
	f.Write(o)
	f.WriteString(fmt.Sprintln())
	return nil
}
981376
func (b *Builder) Insert(i int, p []byte) (n int, err error) {
	b.lastRead = opInvalid
	if i < 0 || i > len(b.buf) {
		return -1, ErrInvalidIndex
	}

	m := b.grow(len(p))
	if len(b.buf)-m != len(p) {
		return -1, ErrFailedToGrow
	}
	copy(b.buf[i+len(p):], b.buf[i:len(b.buf)-len(p)])
	return copy(b.buf[i:i+len(p)], p), nil
}
1262897
func Insert(dst, src string, index int) string {
	return Slice(dst, 0, index) + src + Slice(dst, index, -1)
}
1293747
func (r *UpstreamService) Insert(upstream *Upstream) *UpstreamInsertCall {
	c := &UpstreamInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.upstream = upstream
	return c
}
1290144
func insert(i int, v string, s []string) []string {
	s = append(s, "")
	copy(s[i+1:], s[i:])
	s[i] = v
	return s
}
1051030
func (l *List) insert(e, at *Element) *Element {
	n := at.next
	at.next = e
	e.prev = at
	e.next = n
	n.prev = e
	e.list = l
	l.len++
	return e
}