// And implements And with other conditions
484246
func (like Like) And(conds ...Cond) Cond {
	return And(like, And(conds...))
}
297991
func (i *AtomicInteger) GetAndDecrement() int32 {
	ret := atomic.LoadInt32((*int32)(i))
	atomic.AddInt32((*int32)(i), int32(-1))
	return ret
}
684362
func (qb *Builder) AndEquals(tag string, operand interface{}) *Builder {
	qb.condition.Tag = tag
	qb.condition.Op = equalString
	qb.condition.Operand = operandString(operand)
	return NewBuilder(qb.and(stringIterator(qb.conditionString())))
}
1233165
func (s1 VertexSet) And(s2 VertexSet) VertexSet {
	switch {
	case s1.set == nil:
		return s2
	case s2.set == nil:
		return s1
	}

	type point struct {
		x int
		a bool // Tells if x is a of [a, b).
	}
	points := make([]point, 0, 2*(len(s1.set)+len(s2.set)))
	for _, in := range s1.set {
		points = append(points, point{in.a, true})
		points = append(points, point{in.b, false})
	}
	for _, in := range s2.set {
		points = append(points, point{in.a, true})
		points = append(points, point{in.b, false})
	}
	sort.Slice(points, func(i, j int) bool {
		if points[i].x == points[j].x {
			return !points[i].a
		}
		return points[i].x < points[j].x
	})

	s := empty()
	start, count := 0, 0
	for _, p := range points {
		switch count {
		case 0:
			count++
		case 1:
			if p.a {
				start = p.x
				count++
			} else {
				count--
			}
		case 2:
			s.set = append(s.set, interval{start, p.x, 0})
			count--
		}
	}
	s.update()
	return s
}
712772
func (q *Query) andOr(r *Query, op QueryOp) (out *Query) {
	opstr := "&"
	if op == QOr {
		opstr = "|"
	}
	//println("andOr", q.String(), opstr, r.String())
	//defer func() { println("  ->", out.String()) }()
	_ = opstr

	if len(q.Trigram) == 0 && len(q.Sub) == 1 {
		q = q.Sub[0]
	}
	if len(r.Trigram) == 0 && len(r.Sub) == 1 {
		r = r.Sub[0]
	}

	// Boolean simplification.
	// If q ⇒ r, q AND r ≡ q.
	// If q ⇒ r, q OR r ≡ r.
	if q.implies(r) {
		//println(q.String(), "implies", r.String())
		if op == QAnd {
			return q
		}
		return r
	}
	if r.implies(q) {
		//println(r.String(), "implies", q.String())
		if op == QAnd {
			return r
		}
		return q
	}

	// Both q and r are QAnd or QOr.
	// If they match or can be made to match, merge.
	qAtom := len(q.Trigram) == 1 && len(q.Sub) == 0
	rAtom := len(r.Trigram) == 1 && len(r.Sub) == 0
	if q.Op == op && (r.Op == op || rAtom) {
		q.Trigram = stringSet.union(q.Trigram, r.Trigram, false)
		q.Sub = append(q.Sub, r.Sub...)
		return q
	}
	if r.Op == op && qAtom {
		r.Trigram = stringSet.union(r.Trigram, q.Trigram, false)
		return r
	}
	if qAtom && rAtom {
		q.Op = op
		q.Trigram = append(q.Trigram, r.Trigram...)
		return q
	}

	// If one matches the op, add the other to it.
	if q.Op == op {
		q.Sub = append(q.Sub, r)
		return q
	}
	if r.Op == op {
		r.Sub = append(r.Sub, q)
		return r
	}

	// We are creating an AND of ORs or an OR of ANDs.
	// Factor out common trigrams, if any.
	common := stringSet{}
	i, j := 0, 0
	wi, wj := 0, 0
	for i < len(q.Trigram) && j < len(r.Trigram) {
		qt, rt := q.Trigram[i], r.Trigram[j]
		if qt < rt {
			q.Trigram[wi] = qt
			wi++
			i++
		} else if qt > rt {
			r.Trigram[wj] = rt
			wj++
			j++
		} else {
			common = append(common, qt)
			i++
			j++
		}
	}
	for ; i < len(q.Trigram); i++ {
		q.Trigram[wi] = q.Trigram[i]
		wi++
	}
	for ; j < len(r.Trigram); j++ {
		r.Trigram[wj] = r.Trigram[j]
		wj++
	}
	q.Trigram = q.Trigram[:wi]
	r.Trigram = r.Trigram[:wj]
	if len(common) > 0 {
		// If there were common trigrams, rewrite
		//
		//	(abc|def|ghi|jkl) AND (abc|def|mno|prs) =>
		//		(abc|def) OR ((ghi|jkl) AND (mno|prs))
		//
		//	(abc&def&ghi&jkl) OR (abc&def&mno&prs) =>
		//		(abc&def) AND ((ghi&jkl) OR (mno&prs))
		//
		// Build up the right one of
		//	(ghi|jkl) AND (mno|prs)
		//	(ghi&jkl) OR (mno&prs)
		// Call andOr recursively in case q and r can now be simplified
		// (we removed some trigrams).
		s := q.andOr(r, op)

		// Add in factored trigrams.
		otherOp := QAnd + QOr - op
		t := &Query{Op: otherOp, Trigram: common}
		return t.andOr(s, t.Op)
	}

	// Otherwise just create the op.
	return &Query{Op: op, Sub: []*Query{q, r}}
}
251477
func (s *MetricsFilter) SetAnd(v *MetricsAndOperator) *MetricsFilter {
	s.And = v
	return s
}
207804
func (pr *PluralRule) GoCondition() string {
	var ors []string
	for _, and := range strings.Split(pr.Condition(), "or") {
		var ands []string
		for _, relation := range strings.Split(and, "and") {
			parts := relationRegexp.FindStringSubmatch(relation)
			if parts == nil {
				continue
			}
			lvar, lmod, op, rhs := strings.Title(parts[1]), parts[2], parts[3], strings.TrimSpace(parts[4])
			if op == "=" {
				op = "=="
			}
			lvar = "ops." + lvar
			var rhor []string
			var rany []string
			for _, rh := range strings.Split(rhs, ",") {
				if parts := strings.Split(rh, ".."); len(parts) == 2 {
					from, to := parts[0], parts[1]
					if lvar == "ops.N" {
						if lmod != "" {
							rhor = append(rhor, fmt.Sprintf("ops.NmodInRange(%s, %s, %s)", lmod, from, to))
						} else {
							rhor = append(rhor, fmt.Sprintf("ops.NinRange(%s, %s)", from, to))
						}
					} else if lmod != "" {
						rhor = append(rhor, fmt.Sprintf("intInRange(%s %% %s, %s, %s)", lvar, lmod, from, to))
					} else {
						rhor = append(rhor, fmt.Sprintf("intInRange(%s, %s, %s)", lvar, from, to))
					}
				} else {
					rany = append(rany, rh)
				}
			}

			if len(rany) > 0 {
				rh := strings.Join(rany, ",")
				if lvar == "ops.N" {
					if lmod != "" {
						rhor = append(rhor, fmt.Sprintf("ops.NmodEqualsAny(%s, %s)", lmod, rh))
					} else {
						rhor = append(rhor, fmt.Sprintf("ops.NequalsAny(%s)", rh))
					}
				} else if lmod != "" {
					rhor = append(rhor, fmt.Sprintf("intEqualsAny(%s %% %s, %s)", lvar, lmod, rh))
				} else {
					rhor = append(rhor, fmt.Sprintf("intEqualsAny(%s, %s)", lvar, rh))
				}
			}
			r := strings.Join(rhor, " || ")
			if len(rhor) > 1 {
				r = "(" + r + ")"
			}
			if op == "!=" {
				r = "!" + r
			}
			ands = append(ands, r)
		}
		ors = append(ors, strings.Join(ands, " && "))
	}
	return strings.Join(ors, " ||\n")
}
260808
func SimpleRand() *rand.Rand {
	seed := time.Now().UnixNano()
	source := rand.NewSource(seed)
	return rand.New(source)
}
1050518
func and(groups []Group) []Group {
	op := &andOperation{stack: &stack{}}
	op.and(groups, 0)
	return op.result
}
535649
public Condition<S, D> and(Condition<S, D> condition) {
    Assert.notNull(condition, "condition");
    return Conditions.and(this, condition);
  }
1025656
func (sba *sparseBitArray) And(other BitArray) BitArray {
	if ba, ok := other.(*sparseBitArray); ok {
		return andSparseWithSparseBitArray(sba, ba)
	}

	return andSparseWithDenseBitArray(sba, other.(*bitArray))
}
1220383
func (gt Gt) And(conds ...Cond) Cond {
	return And(gt, And(conds...))
}
653264
func (v *ValidatorList) And(validator Validator) *ValidatorList {
	(*v) = append((*v), validator)
	return v
}
405607
func (s *SelectQuery) AndHaving(e Expression) *SelectQuery {
	s.having = And(s.having, e)
	return s
}
187229
func (b *Builder) Where(cond Cond) *Builder {
	if b.cond.IsValid() {
		b.cond = b.cond.And(cond)
	} else {
		b.cond = cond
	}
	return b
}
622067
func (t Term) And(args ...interface{}) Term {
	return constructMethodTerm(t, "And", p.Term_AND, args, map[string]interface{}{})
}
1314804
func (s *LifecycleRuleFilter) SetAnd(v *LifecycleRuleAndOperator) *LifecycleRuleFilter {
	s.And = v
	return s
}