// If returns a new instance of IfFunc for the provided string expressions.
//
// See also: IfList
492049
func If(condition string, valueIfTrue, valueIfFalse Stringable) IfFunc {
	return IfFunc{
		list:         false,
		Condition:    condition,
		ValueIfTrue:  *valueIfTrue.String(),
		ValueIfFalse: *valueIfFalse.String(),
	}
}
722641
func booleanFunc(q query, t iterator) interface{} {
	v := q.Evaluate(t)
	return asBool(t, v)
}
2708
func (rf Reducer) If(f func(*mesos.Resource) bool) Reducer {
	if f == nil {
		return rf
	}
	return func(acc, x *mesos.Resource) *mesos.Resource {
		if f(x) {
			return rf(acc, x)
		}
		return acc
	}
}
1154398
func (fn typeFunc) Matches(types []reflect.Type) bool {
	if len(fn.Extra) != len(types) {
		return false
	}
	// reorder the items in array types and fn.Extra
	// convert the type into string and sort them, check if they are matched
	varMap := make(map[reflect.Type]bool)
	for i := range fn.Extra {
		varMap[fn.Extra[i]] = true
	}
	for i := range types {
		if _, found := varMap[types[i]]; !found {
			return false
		}
	}
	return true
}
1268259
func (b Bool) If(fn func(bool)) {
	if b.Present() {
		fn(*b.value)
	}
}
322546
func (u Uint16) If(fn func(uint16)) {
	if u.Present() {
		fn(*u.value)
	}
}
977328
func IfList(condition string, valueIfTrue, valueIfFalse StringListable) IfFunc {
	return IfFunc{
		list:         true,
		Condition:    condition,
		ValueIfTrue:  *valueIfTrue.StringList(),
		ValueIfFalse: *valueIfFalse.StringList(),
	}
}
835776
func (b *UpdateBuilder) If(w ...Cmp) *UpdateBuilder {
	b._if = append(b._if, w...)
	return b
}
230510
func (n *Namespace) Conditional(condition bool, a, b interface{}) interface{} {
	if condition {
		return a
	}
	return b
}
927381
func (f CountersFunc) String() string {
	m := f()
	if m == nil {
		return "{}"
	}
	return counterToString(m)
}
1360135
func (m *Mock) When(name string, arguments ...interface{}) *MockFunction {
	defer m.mutex.Unlock()
	m.mutex.Lock()

	f := &MockFunction{
		Name:      name,
		Arguments: arguments,
	}

	m.Functions = append(m.Functions, f)
	return f
}
1371693
func (c CountersFuncWithMultiLabels) String() string {
	m := c.f()
	if m == nil {
		return "{}"
	}
	b := bytes.NewBuffer(make([]byte, 0, 4096))
	fmt.Fprintf(b, "{")
	firstValue := true
	for k, v := range m {
		if firstValue {
			firstValue = false
		} else {
			fmt.Fprintf(b, ", ")
		}
		fmt.Fprintf(b, "%q: %v", k, v)
	}
	fmt.Fprintf(b, "}")
	return b.String()
}
473912
func (list *List) Filter(f func(string) bool) {
	if list.length == 0 {
		return
	}
	var start, current *ListItem
	length := 0
	tmp := list.first
	for i := 0; i < list.length; i++ {
		if f(tmp.Content) {
			if length == 0 {
				start = tmp
				current = tmp
			} else {
				current.Next = tmp
				current = tmp
			}
			length++
		}
		if tmp.Next != nil {
			tmp = tmp.Next
		} else {
			break
		}
	}
	list.first = start
	list.last = current
	list.length = length
}
924032
func (e *ComplexExplanation) IsMatch() bool {
	return e.match != nil && e.match.(bool) || e.match == nil && e.ExplanationImpl.IsMatch()
}
1371483
func (f *functionQuery) Evaluate(t iterator) interface{} {
	return f.Func(f.Input, t)
}
1060090
func (L *State) IsFunction(index int) bool {
	return LuaValType(C.lua_type(L.s, C.int(index))) == LUA_TFUNCTION
}
67388
func (g *Group) CaseFunc(f func(*Group)) *Statement {
	s := CaseFunc(f)
	g.items = append(g.items, s)
	return s
}