// Generic add function for filter rules
13404
func (f *ScmpFilter) addRuleGeneric(call ScmpSyscall, action ScmpAction, exact bool, conds []ScmpCondition) error {
	f.lock.Lock()
	defer f.lock.Unlock()

	if !f.valid {
		return errBadFilter
	}

	if len(conds) == 0 {
		if err := f.addRuleWrapper(call, action, exact, 0, nil); err != nil {
			return err
		}
	} else {
		// We don't support conditional filtering in library version v2.1
		if !checkVersionAbove(2, 2, 1) {
			return VersionError{
				message: "conditional filtering is not supported",
				minimum: "2.2.1",
			}
		}

		argsArr := C.make_arg_cmp_array(C.uint(len(conds)))
		if argsArr == nil {
			return fmt.Errorf("error allocating memory for conditions")
		}
		defer C.free(argsArr)

		for i, cond := range conds {
			C.add_struct_arg_cmp(C.scmp_cast_t(argsArr), C.uint(i),
				C.uint(cond.Argument), cond.Op.toNative(),
				C.uint64_t(cond.Operand1), C.uint64_t(cond.Operand2))
		}

		if err := f.addRuleWrapper(call, action, exact, C.uint(len(conds)), C.scmp_cast_t(argsArr)); err != nil {
			return err
		}
	}

	return nil
}
31222
func Generic(n int, edge FilterFunc) *Virtual {
	switch {
	case n < 0:
		return nil
	case n == 0:
		return null
	case n == 1:
		return singleton()
	case edge == nil:
		return Kn(n)
	}
	return generic0(n, edge)
}
825067
func AddNewerFilter(q *ds.Query, t time.Time) *ds.Query {
	return q.Gt("Created", t.UTC()).Order("-Created")
}
116009
func (f *List) AddFilters(filters ...Filter) {
	for _, filter := range filters {
		fpb, err := filter.ConstructPBFilter()
		if err != nil {
			panic(err)
		}
		f.Filters = append(f.Filters, fpb)
	}
}
854177
func (p FilterPolicy) AppendFilter(dst []byte, keys [][]byte) []byte {
	return appendFilter(dst, keys, int(p))
}
936611
func (p *PacketFilter) AddICMPRuleAt(sourceNetwork string, description string, isAllow bool, index int) (*PacketFilterExpression, error) {

	exp := p.createICMPRule(sourceNetwork, description, isAllow)
	p.addRuleAt(exp, index)
	return exp, nil
}
282181
func FilterS(f func(string) bool, sl []string) (result []string) {
	result = make([]string, 0)
	for i := range sl {
		if f(sl[i]) {
			result = append(result, sl[i])
		}
	}
	return result
}
139052
func AddFilter(name string, lvl level, writer LogWriter) {
	Global.AddFilter(name, lvl, writer)

}
137256
func (f *Filter) addNewFilter(log uint, k int) {
	//make sure we have up to k hashes
	for len(f.hs) < k {
		f.hs = append(f.hs, newsHash(f.bh))
	}

	//add the new bloom filter
	f.fs = append(f.fs, newFilter(log, k))
}
531289
func (p *PacketFilter) AddIPRule(sourceNetwork string, description string, isAllow bool) (*PacketFilterExpression, error) {

	exp := p.createIPRule(sourceNetwork, description, isAllow)
	p.Expression = append(p.Expression, exp)
	return exp, nil
}
1355373
func (r *Request) Filter(fn FilterRequestFunc) *Request {
	r.Filters = append(r.Filters, fn)
	return r
}
70839
func (p *aeBackupInformationKindTypeInfoQueryProperty) Filter(op string, value interface{}) *aeBackupInformationKindTypeInfoQueryBuilder {
	switch op {
	case "<=":
		p.LessThanOrEqual(value)
	case ">=":
		p.GreaterThanOrEqual(value)
	case "<":
		p.LessThan(value)
	case ">":
		p.GreaterThan(value)
	case "=":
		p.Equal(value)
	default:
		p.bldr.q = p.bldr.q.Filter(p.name+" "+op, value) // error raised by native query
	}
	if p.bldr.plugin != nil {
		p.bldr.plugin.Filter(p.name, op, value)
	}
	return p.bldr
}
1107374
func (x Vector) Filter(f func(float64) bool) Vector {
	y := make(Vector, 0, len(x))

	for _, v := range x {
		if !f(v) {
			y = append(y, v)
		}
	}

	return y
}
806054
func (c *Container) Filter(filter FilterFunction) {
	c.containerFilters = append(c.containerFilters, filter)
}
1109154
func (hook *AppInsightsHook) AddFilter(name string, fn func(interface{}) interface{}) {
	hook.filters[name] = fn
}
1192696
func (conf FilterConfigurator) Add(f Filter) FilterConfigurator {
	conf.apply(func(fc []Filter) []Filter {
		return conf.addFilter(f, fc)
	})
	return conf
}
552896
func (s *NestedSort) Filter(filter Query) *NestedSort {
	s.filter = filter
	return s
}