/*
Returns true if these two automata accept exactly the same language.
This is a costly computation! Note also that a1 and a2 will be
determinized as a side effect.
*/
7618
func sameLanguage(a1, a2 *Automaton) bool {
	if a1 == a2 {
		return true
	}
	return subsetOf(a2, a1) && subsetOf(a1, a2)
}
1058213
func AreEqual(first, second api.Toleration) bool {
	if first.Key == second.Key &&
		first.Operator == second.Operator &&
		first.Value == second.Value &&
		first.Effect == second.Effect &&
		AreTolerationSecondsEqual(first.TolerationSeconds, second.TolerationSeconds) {
		return true
	}
	return false
}
993997
func (a *Automaton) copy(other *Automaton) {
	// bulk copy and then fixup the state pointers
	stateOffset := a.numStates()
	a.states = append(a.states, other.states...)
	for i := 0; i < len(other.states); i += 2 {
		if a.states[stateOffset*2+i] != -1 {
			a.states[stateOffset*2+i] += len(a.transitions)
		}
	}
	otherAcceptState := other.isAccept
	for state := otherAcceptState.NextSetBit(0); state != -1; state = otherAcceptState.NextSetBit(state + 1) {
		a.setAccept(stateOffset+int(state), true)
	}

	// bulk copy and then fixup dest for each transition
	transOffset := len(a.transitions)
	a.transitions = append(a.transitions, other.transitions...)
	for i := 0; i < len(other.transitions); i += 3 {
		a.transitions[transOffset+i] += stateOffset
	}

	if !other.deterministic {
		a.deterministic = false
	}
}
331862
func (m *DFA) States() []State {
	q := make([]State, 0, len(m.q))
	for s, _ := range m.q {
		q = append(q, s)
	}
	return q
}
1111386
func (a acceptCriterion) matches(t string) bool {
	st := strings.SplitN(t, "/", 2)

	if a.major != "*" && a.major != st[0] {
		return false
	}
	if a.minor != "*" && a.minor != st[1] {
		return false
	}
	return true
}
1360221
func hasCompatDecomp(r rune) bool {
	c := &chars[r]
	if c.compatDecomp {
		return true
	}
	for _, d := range c.forms[FCompatibility].decomp {
		if hasCompatDecomp(d) {
			return true
		}
	}
	return false
}
1056506
func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
	if h, ok := t.(tHelper); ok {
		h.Helper()
	}

	expectedPtr, actualPtr := reflect.ValueOf(expected), reflect.ValueOf(actual)
	if expectedPtr.Kind() != reflect.Ptr || actualPtr.Kind() != reflect.Ptr {
		return Fail(t, "Invalid operation: both arguments must be pointers", msgAndArgs...)
	}

	expectedType, actualType := reflect.TypeOf(expected), reflect.TypeOf(actual)
	if expectedType != actualType {
		return Fail(t, fmt.Sprintf("Pointer expected to be of type %v, but was %v",
			expectedType, actualType), msgAndArgs...)
	}

	if expected != actual {
		return Fail(t, fmt.Sprintf("Not same: \n"+
			"expected: %p %#v\n"+
			"actual  : %p %#v", expected, expected, actual, actual), msgAndArgs...)
	}

	return true
}
503033
func equals(v1, v2 interface{}) bool {
	v1Type := jsonType(v1)
	if v1Type != jsonType(v2) {
		return false
	}
	switch v1Type {
	case "array":
		arr1, arr2 := v1.([]interface{}), v2.([]interface{})
		if len(arr1) != len(arr2) {
			return false
		}
		for i := range arr1 {
			if !equals(arr1[i], arr2[i]) {
				return false
			}
		}
		return true
	case "object":
		obj1, obj2 := v1.(map[string]interface{}), v2.(map[string]interface{})
		if len(obj1) != len(obj2) {
			return false
		}
		for k, v1 := range obj1 {
			if v2, ok := obj2[k]; ok {
				if !equals(v1, v2) {
					return false
				}
			} else {
				return false
			}
		}
		return true
	case "number":
		num1, _ := new(big.Float).SetString(string(v1.(json.Number)))
		num2, _ := new(big.Float).SetString(string(v2.(json.Number)))
		return num1.Cmp(num2) == 0
	default:
		return v1 == v2
	}
}
986302
func (v *ListTypeVersioningV2) Equals(rhs *ListTypeVersioningV2) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Strings == nil && rhs.Strings == nil) || (v.Strings != nil && rhs.Strings != nil && _List_String_Equals(v.Strings, rhs.Strings))) {
		return false
	}
	if !_String_EqualsPtr(v.Hello, rhs.Hello) {
		return false
	}

	return true
}
523033
func VerifyParts(m1, m2 string) bool {
	if m1 == m2 {
		return true
	}

	mc := string(MessageChar)

	p1, p2 := strings.Split(m1, mc), strings.Split(m2, mc)
	if len(p1) != len(p2) || len(p1) == 0 {
		return false
	}
	for i, p := range p1[1:] {
		if len(p) == 0 || len(p2[i+1]) == 0 {
			return false
		}
	}
	return true
}
89771
func (i If) True(r *dns.Msg) bool {
	if c, ok := conditions[i.Operator]; ok {
		a, b := i.A, i.B
		if r != nil {
			ctx := context.TODO()
			state := request.Request{Req: r, W: nil} // hmm W nil?
			a = repl.Replace(ctx, state, nil, i.A)
			b = repl.Replace(ctx, state, nil, i.B)
		}
		return c(a, b)
	}
	return false
}
1353853
func intersection(a1, a2 *Automaton) *Automaton {
	if a1 == a2 || a1.numStates() == 0 {
		return a1
	}
	if a2.numStates() == 0 {
		return a2
	}

	transitions1 := a1.sortedTransitions()
	transitions2 := a2.sortedTransitions()
	c := newEmptyAutomaton()
	c.createState()
	worklist := list.New()
	newstates := make(map[string]*StatePair)
	hash := func(p *StatePair) string {
		return fmt.Sprintf("%v/%v", p.s1, p.s2)
	}
	p := &StatePair{0, 0, 0}
	worklist.PushBack(p)
	newstates[hash(p)] = p
	for worklist.Len() > 0 {
		p = worklist.Remove(worklist.Front()).(*StatePair)
		c.setAccept(p.s, a1.IsAccept(p.s1) && a2.IsAccept(p.s2))
		t1 := transitions1[p.s1]
		t2 := transitions2[p.s2]
		for n1, b2 := 0, 0; n1 < len(t1); n1++ {
			for b2 < len(t2) && t2[b2].max < t1[n1].min {
				b2++
			}
			for n2 := b2; n2 < len(t2) && t1[n1].max >= t2[n2].min; n2++ {
				if t2[n2].max >= t1[n1].min {
					q := &StatePair{-1, t1[n1].dest, t2[n2].dest}
					r, ok := newstates[hash(q)]
					if !ok {
						q.s = c.createState()
						worklist.PushBack(q)
						newstates[hash(q)] = q
						r = q
					}
					min := or(t1[n1].min > t2[n2].min, t1[n1].min, t2[n2].min).(int)
					max := or(t1[n1].max < t2[n2].max, t1[n1].max, t2[n2].max).(int)
					c.addTransitionRange(p.s, r.s, min, max)
				}
			}
		}
	}
	c.finishState()
	return removeDeadStates(c)
}
905179
func (t *precompilationTypeChecker) AcceptNumericLiteral(v tree.NumericLiteral) {
	if v.Value > 0xFFFFFFFF {
		t.result = fmt.Errorf("no literals larger than 0xFFFFFFFF allowed - this is probably a programmer error: 0x%X", v.Value)
	}
}
1164380
func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
	if h, ok := t.(tHelper); ok {
		h.Helper()
	}

	aType := reflect.TypeOf(expected)
	bType := reflect.TypeOf(actual)

	if aType != bType {
		return Fail(t, fmt.Sprintf("Types expected to match exactly\n\t%v != %v", aType, bType), msgAndArgs...)
	}

	return Equal(t, expected, actual, msgAndArgs...)

}
1236984
func (mls MultiLineString) Equal(multiLineString MultiLineString) bool {
	if len(mls) != len(multiLineString) {
		return false
	}

	for i, ls := range mls {
		if !ls.Equal(multiLineString[i]) {
			return false
		}
	}

	return true
}
1134154
func (c *Client) LanguageCodes() ([]*models.LanguageCode, error) {
	var err error
	var result []*models.LanguageCode

	data, err := httpGet(geonamesURL + languageCodesURL)
	if err != nil {
		return nil, err
	}

	parse(data, 1, func(raw [][]byte) bool {
		if len(raw) != 4 {
			return true
		}

		result = append(result, &models.LanguageCode{
			Iso3: string(raw[0]),
			Iso2: string(raw[1]),
			Iso:  string(raw[2]),
			Name: string(raw[3]),
		})

		return true
	})

	return result, nil
}
593625
func areEqual(a, b interface{}) bool {
	if isNil(a) || isNil(b) {
		if isNil(a) && !isNil(b) {
			return false
		}
		if !isNil(a) && isNil(b) {
			return false
		}
		return true
	}
	if reflect.DeepEqual(a, b) {
		return true
	}
	aValue := reflect.ValueOf(a)
	bValue := reflect.ValueOf(b)
	return aValue == bValue
}