// ExtractNumericAttributesForFiltering returns the first found NumericAttributesForFilteringOption from the
// given variadic arguments or nil otherwise.
492713
func ExtractNumericAttributesForFiltering(opts ...interface{}) *opt.NumericAttributesForFilteringOption {
	for _, o := range opts {
		if v, ok := o.(*opt.NumericAttributesForFilteringOption); ok {
			return v
		}
	}
	return nil
}
1203911
func (r Hardware_Component_Model) GetValidAttributeTypes() (resp []datatypes.Hardware_Component_Model_Attribute_Type, err error) {
	err = r.Session.DoRequest("SoftLayer_Hardware_Component_Model", "getValidAttributeTypes", nil, &r.Options, &resp)
	return
}
53497
func attributePrefixSelector(key, val string) Selector {
	return attributeSelector(key,
		func(s string) bool {
			if strings.TrimSpace(s) == "" {
				return false
			}
			return strings.HasPrefix(s, val)
		})
}
1092529
func (cm AsStandard) MFilterType(filter string) *metadata.MFilterType {
	mft := metadata.MFilterType{}
	mi := metadata.MIFilterType
	for _, cd := range cm.Elements[mi.Name] {
		if cd.Attr["Filter"] != filter {
			continue
		}
		metadata.FieldTransfer(cd.Attr).To(&mft)
		for _, entry := range cd.Entries() {
			tmp := metadata.FilterType{}
			entry.SetFields(&tmp)
			mft.FilterType = append(mft.FilterType, tmp)
		}
	}
	return &mft
}
1160179
func (b *BinningFilter) GetAttributesAfterFiltering() []base.FilteredAttribute {
	oldAttrs := b.train.AllAttributes()
	ret := make([]base.FilteredAttribute, len(oldAttrs))
	for i, a := range oldAttrs {
		if b.attrs[a] {
			retAttr := new(base.CategoricalAttribute)
			minVal := b.minVals[a]
			maxVal := b.maxVals[a]
			delta := float64(maxVal-minVal) / float64(b.bins)
			retAttr.SetName(a.GetName())
			for i := 0; i <= b.bins; i++ {
				floatVal := float64(i)*delta + minVal
				fmtStr := fmt.Sprintf("%%.%df", a.(*base.FloatAttribute).Precision)
				binVal := fmt.Sprintf(fmtStr, floatVal)
				retAttr.GetSysValFromString(binVal)
			}
			ret[i] = base.FilteredAttribute{a, retAttr}
		} else {
			ret[i] = base.FilteredAttribute{a, a}
		}
	}
	return ret
}
426248
func ExtractOptionalFilters(opts ...interface{}) *opt.OptionalFiltersOption {
	for _, o := range opts {
		if v, ok := o.(*opt.OptionalFiltersOption); ok {
			return v
		}
	}
	return nil
}
268468
func (r *Reflex) filterMatching(out chan<- string, in <-chan string) {
	for name := range in {
		if !r.matcher.Match(name) {
			continue
		}

		if r.onlyFiles || r.onlyDirs {
			stat, err := os.Stat(name)
			if err != nil {
				continue
			}
			if (r.onlyFiles && stat.IsDir()) || (r.onlyDirs && !stat.IsDir()) {
				continue
			}
		}
		out <- name
	}
}
1135877
func ExtractQueryType(opts ...interface{}) *opt.QueryTypeOption {
	for _, o := range opts {
		if v, ok := o.(*opt.QueryTypeOption); ok {
			return v
		}
	}
	return nil
}
336405
func ByAttributes(f func(attr []mesos.Attribute) bool) Filter {
	if f == nil {
		return FilterFunc(nil)
	}
	return FilterFunc(func(o *mesos.Offer) bool {
		return f(o.Attributes)
	})
}
542456
func (v *validate) extractTypeInternal(current reflect.Value, nullable bool) (reflect.Value, reflect.Kind, bool) {

BEGIN:
	switch current.Kind() {
	case reflect.Ptr:

		nullable = true

		if current.IsNil() {
			return current, reflect.Ptr, nullable
		}

		current = current.Elem()
		goto BEGIN

	case reflect.Interface:

		nullable = true

		if current.IsNil() {
			return current, reflect.Interface, nullable
		}

		current = current.Elem()
		goto BEGIN

	case reflect.Invalid:
		return current, reflect.Invalid, nullable

	default:

		if v.v.hasCustomFuncs {

			if fn, ok := v.v.customFuncs[current.Type()]; ok {
				current = reflect.ValueOf(fn(current))
				goto BEGIN
			}
		}

		return current, current.Kind(), nullable
	}
}
1276591
func FilterInt64(s []int64, cb func(s int64) bool) []int64 {
	results := []int64{}

	for _, i := range s {
		result := cb(i)

		if result {
			results = append(results, i)
		}
	}

	return results
}
501144
func ExtractType(opts ...interface{}) *opt.TypeOption {
	for _, o := range opts {
		if v, ok := o.(*opt.TypeOption); ok {
			return v
		}
	}
	return nil
}
430466
func (p *parser) parseAttributeSelector() (Selector, error) {
	if p.i >= len(p.s) {
		return nil, fmt.Errorf("expected attribute selector ([attribute]), found EOF instead")
	}
	if p.s[p.i] != '[' {
		return nil, fmt.Errorf("expected attribute selector ([attribute]), found '%c' instead", p.s[p.i])
	}

	p.i++
	p.skipWhitespace()
	key, err := p.parseIdentifier()
	if err != nil {
		return nil, err
	}

	p.skipWhitespace()
	if p.i >= len(p.s) {
		return nil, errors.New("unexpected EOF in attribute selector")
	}

	if p.s[p.i] == ']' {
		p.i++
		return attributeExistsSelector(key), nil
	}

	if p.i+2 >= len(p.s) {
		return nil, errors.New("unexpected EOF in attribute selector")
	}

	op := p.s[p.i : p.i+2]
	if op[0] == '=' {
		op = "="
	} else if op[1] != '=' {
		return nil, fmt.Errorf(`expected equality operator, found "%s" instead`, op)
	}
	p.i += len(op)

	p.skipWhitespace()
	if p.i >= len(p.s) {
		return nil, errors.New("unexpected EOF in attribute selector")
	}
	var val string
	var rx *regexp.Regexp
	if op == "#=" {
		rx, err = p.parseRegex()
	} else {
		switch p.s[p.i] {
		case '\'', '"':
			val, err = p.parseString()
		default:
			val, err = p.parseIdentifier()
		}
	}
	if err != nil {
		return nil, err
	}

	p.skipWhitespace()
	if p.i >= len(p.s) {
		return nil, errors.New("unexpected EOF in attribute selector")
	}
	if p.s[p.i] != ']' {
		return nil, fmt.Errorf("expected ']', found '%c' instead", p.s[p.i])
	}
	p.i++

	switch op {
	case "=":
		return attributeEqualsSelector(key, val), nil
	case "~=":
		return attributeIncludesSelector(key, val), nil
	case "|=":
		return attributeDashmatchSelector(key, val), nil
	case "^=":
		return attributePrefixSelector(key, val), nil
	case "$=":
		return attributeSuffixSelector(key, val), nil
	case "*=":
		return attributeSubstringSelector(key, val), nil
	case "#=":
		return attributeRegexSelector(key, rx), nil
	}

	return nil, fmt.Errorf("attribute operator %q is not supported", op)
}
659945
func VectorizedFilter(ctx sessionctx.Context, filters []Expression, iterator *chunk.Iterator4Chunk, selected []bool) ([]bool, error) {
	selected = selected[:0]
	for i, numRows := 0, iterator.Len(); i < numRows; i++ {
		selected = append(selected, true)
	}
	for _, filter := range filters {
		isIntType := true
		if filter.GetType().EvalType() != types.ETInt {
			isIntType = false
		}
		for row := iterator.Begin(); row != iterator.End(); row = iterator.Next() {
			if !selected[row.Idx()] {
				continue
			}
			if isIntType {
				filterResult, isNull, err := filter.EvalInt(ctx, row)
				if err != nil {
					return nil, err
				}
				selected[row.Idx()] = selected[row.Idx()] && !isNull && (filterResult != 0)
			} else {
				// TODO: should rewrite the filter to `cast(expr as SIGNED) != 0` and always use `EvalInt`.
				bVal, _, err := EvalBool(ctx, []Expression{filter}, row)
				if err != nil {
					return nil, err
				}
				selected[row.Idx()] = selected[row.Idx()] && bVal
			}
		}
	}
	return selected, nil
}
346132
func ExtractFilters(opts ...interface{}) *opt.FiltersOption {
	for _, o := range opts {
		if v, ok := o.(*opt.FiltersOption); ok {
			return v
		}
	}
	return nil
}
369501
func ExtractAttributesToHighlight(opts ...interface{}) *opt.AttributesToHighlightOption {
	for _, o := range opts {
		if v, ok := o.(*opt.AttributesToHighlightOption); ok {
			return v
		}
	}
	return nil
}
163191
func (fm *filterManager) NumFilter() int {
	fm.fmLocker.RLock()
	defer fm.fmLocker.RUnlock()
	return len(fm.filters)
}