// AtIndex gets a single field from an object or the nth element from a sequence.
765961
func (t Term) AtIndex(args ...interface{}) Term {
	return constructMethodTerm(t, "AtIndex", p.Term_BRACKET, args, map[string]interface{}{})
}
409028
func (s *IndicesGetFieldMappingService) Index(indices ...string) *IndicesGetFieldMappingService {
	s.index = append(s.index, indices...)
	return s
}
1022555
func (aSpace *addrSpace) SetIndex(index uint64) {
	aSpace.Lock()
	aSpace.dbIndex = index
	aSpace.dbExists = true
	aSpace.Unlock()
}
455048
func (n *node) AllByIndex(fieldName string, to interface{}, options ...func(*index.Options)) error {
	if fieldName == "" {
		return n.All(to, options...)
	}

	ref := reflect.ValueOf(to)

	if ref.Kind() != reflect.Ptr || ref.Elem().Kind() != reflect.Slice {
		return ErrSlicePtrNeeded
	}

	typ := reflect.Indirect(ref).Type().Elem()

	if typ.Kind() == reflect.Ptr {
		typ = typ.Elem()
	}

	newElem := reflect.New(typ)

	cfg, err := extract(&newElem)
	if err != nil {
		return err
	}

	if cfg.ID.Name == fieldName {
		return n.All(to, options...)
	}

	opts := index.NewOptions()
	for _, fn := range options {
		fn(opts)
	}

	return n.readTx(func(tx *bolt.Tx) error {
		return n.allByIndex(tx, fieldName, cfg, &ref, opts)
	})
}
1329973
func (l *list) FindIndex(pred func(interface{}) bool) int {
	curr := l
	idx := 0
	for {
		if pred(curr.head) {
			return idx
		}
		tail, _ := curr.Tail()
		if tail.IsEmpty() {
			return -1
		}
		curr = tail.(*list)
		idx += 1
	}
}
1063519
func (s *PersonDetail) SetIndex(v int64) *PersonDetail {
	s.Index = &v
	return s
}
1176403
func (bA *BitArray) SetIndex(i int, v bool) bool {
	if bA == nil {
		return false
	}
	bA.mtx.Lock()
	defer bA.mtx.Unlock()
	return bA.setIndex(i, v)
}
908627
func getIndex(pk crypto.PubKey, keys []crypto.PubKey) int {
	for i := 0; i < len(keys); i++ {
		if pk.Equals(keys[i]) {
			return i
		}
	}
	return -1
}
570143
func (s *NodePropertiesSummary) SetNodeIndex(v int64) *NodePropertiesSummary {
	s.NodeIndex = &v
	return s
}
1115597
func (o *Object) AddToIntIndex(indexName string, indexValue int) {
	o.AddToIndex(indexName, fmt.Sprintf("%v", indexValue))
}
1200634
func (bA *CompactBitArray) GetIndex(i int) bool {
	if bA == nil {
		return false
	}
	if i >= bA.Size() {
		return false
	}
	return bA.Elems[i>>3]&(uint8(1)<<uint8(7-(i%8))) > 0
}
726135
func (s *TermvectorsService) Index(index string) *TermvectorsService {
	s.index = index
	return s
}
1007446
func (h *Client) ListIndex(listIndex string) *Client {
	h.listIndex = listIndex
	h.listIndexSet = true
	return h
}
514126
func (s *BatchDetectEntitiesItemResult) SetIndex(v int64) *BatchDetectEntitiesItemResult {
	s.Index = &v
	return s
}
804229
func LastIndex(s T, val interface{}) int {
	rs := reflectSlice(s)
	if vt := reflect.TypeOf(val); rs.Type().Elem() != vt {
		// TODO: Better "<seq> is not a sequence of <val>".
		panic(&generic.TypeError{rs.Type(), vt, "cannot find"})
	}

	for i := rs.Len() - 1; i >= 0; i-- {
		if rs.Index(i).Interface() == val {
			return i
		}
	}
	return -1
}
9579
func (h *HLLPP) getIndex(k uint32, p uint8) uint32 {
	if k&1 > 0 {
		return sliceBits32(k, 6+h.pp, 1+6+h.pp-p)
	} else {
		return sliceBits32(k, h.pp, 1+h.pp-p)
	}
}
854309
func (s *compoundSection) relativeIndex() []uint32 {
	ri := make([]uint32, 0, len(s.offsets)+1)
	for _, o := range s.offsets {
		ri = append(ri, o-s.offsets[0])
	}
	if len(s.offsets) > 0 {
		ri = append(ri, s.data.sz)
	}
	return ri
}