// idx returns the index into aa corresponding to attr a.
// If h is too small, idx returns tooSmall (-1).
// If h is too large, idx returns tooLarge (-2).
325479
func (r *attrRange) idx(h int) int {
	if h < int(r.base) {
		return tooSmall
	}
	if int(h) >= int(r.base)+len(r.aa) {
		return tooLarge
	}
	return h - int(r.base)
}
1138174
func (s *IndicesGetMappingService) Index(indices ...string) *IndicesGetMappingService {
	s.index = append(s.index, indices...)
	return s
}
1181346
func (table *Table) GetColumnIdx(name string, idx int) *Column {
	if c, ok := table.columnsMap[strings.ToLower(name)]; ok {
		if idx < len(c) {
			return c[idx]
		}
	}
	return nil
}
500010
func (s *IndicesAnalyzeService) Index(index string) *IndicesAnalyzeService {
	s.index = index
	return s
}
137287
func (h Headers) Index(k string) int {
	r := -1
	for i := 0; i < len(h); i += 2 {
		if h[i] == k {
			r = i
			break
		}
	}
	return r
}
551415
func (v *Value) Index(i int) *Value {
	switch v.getResolvedValue().Kind() {
	case reflect.Array, reflect.Slice:
		if i >= v.Len() {
			return AsValue(nil)
		}
		return AsValue(v.getResolvedValue().Index(i).Interface())
	case reflect.String:
		//return AsValue(v.getResolvedValue().Slice(i, i+1).Interface())
		s := v.getResolvedValue().String()
		runes := []rune(s)
		if i < len(runes) {
			return AsValue(string(runes[i]))
		}
		return AsValue("")
	default:
		logf("Value.Slice() not available for type: %s\n", v.getResolvedValue().Kind().String())
		return AsValue([]int{})
	}
}
55729
func (s *AliasesService) Index(index ...string) *AliasesService {
	s.index = append(s.index, index...)
	return s
}
909133
func (a *KVData) Index(k string) []int {
	v, _ := a.index[k]
	return v
}
988559
func (s *CountService) Indices(indices ...string) *CountService {
	if s.index == nil {
		s.index = make([]string, 0)
	}
	s.index = append(s.index, indices...)
	return s
}
409028
func (s *IndicesGetFieldMappingService) Index(indices ...string) *IndicesGetFieldMappingService {
	s.index = append(s.index, indices...)
	return s
}
630401
func (c *VPCRouterDHCPServerConfig) InterfaceIndex() int {
	strIndex := strings.Replace(c.Interface, "eth", "", -1)
	index, err := strconv.Atoi(strIndex)
	if err != nil {
		return -1
	}
	return index
}
746194
func (idx *index) match(key string) bool {
	if idx.pattern == "*" {
		return true
	}
	if idx.opts.CaseInsensitiveKeyMatching {
		for i := 0; i < len(key); i++ {
			if key[i] >= 'A' && key[i] <= 'Z' {
				key = strings.ToLower(key)
				break
			}
		}
	}
	return match.Match(key, idx.pattern)
}
839123
func valueToRangeIndex(indexValue Value, length int64, negativeIsZero bool) int64 {
	index := indexValue.number().int64
	if negativeIsZero {
		if index < 0 {
			index = 0
		}
		// minimum(index, length)
		if index >= length {
			index = length
		}
		return index
	}

	if index < 0 {
		index += length
		if index < 0 {
			index = 0
		}
	} else {
		if index > length {
			index = length
		}
	}
	return index
}
73239
func (pd *PictureData) Index(at Vec) int {
	at = at.Sub(pd.Rect.Min.Map(math.Floor))
	x, y := int(at.X), int(at.Y)
	return y*pd.Stride + x
}
59953
func IndexInt(a, b string) bool {
	ia, _ := strconv.ParseInt(a, 10, 64)
	ib, _ := strconv.ParseInt(b, 10, 64)
	return ia < ib
}
1295313
func (r *ReindexDestination) Index(index string) *ReindexDestination {
	r.index = index
	return r
}
551483
func (t *ticket) findIdx(topic Topic) int {
	for i, tt := range t.topics {
		if tt == topic {
			return i
		}
	}
	return -1
}