// interfaces Equivable, Hashable
// Equiv returns true if this Cons is eqivalent to the given object, treated as an iseq.Seqable.
349236
func (c *Cons) Equiv(o interface{}) bool {
	if c == o {
		return true
	}

	if os, ok := o.(iseq.Seqable); ok {
		return sequtil.SeqEquiv(c, os.Seq())
	}

	// TODO: handle built-in 'sequable' things such as arrays, slices, strings
	return false
}
762483
func (h *Hash) IsCompatible(val interface{}) bool {
	k := reflect.TypeOf(val).Kind()
	if k != reflect.Map {
		return false
	}
	v := reflect.ValueOf(val)
	for _, key := range v.MapKeys() {
		keyCompat := h.KeyType.Type == nil || h.KeyType.Type.IsCompatible(key.Interface())
		elemCompat := h.ElemType.Type == nil || h.ElemType.Type.IsCompatible(v.MapIndex(key).Interface())
		if !keyCompat || !elemCompat {
			return false
		}
	}
	return true
}
180022
func (i *IntValue) Eq(other *IntValue) bool {
	if i == nil {
		return other == nil
	}

	if other == nil {
		return i == nil
	}

	return *i == *other
}
690024
func (*Namespace) Eq(x, y interface{}) bool {
	if e, ok := x.(compare.Eqer); ok {
		return e.Eq(y)
	}

	if e, ok := y.(compare.Eqer); ok {
		return e.Eq(x)
	}

	normalize := func(v interface{}) interface{} {
		if types.IsNil(v) {
			return nil
		}
		vv := reflect.ValueOf(v)
		switch vv.Kind() {
		case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
			return vv.Int()
		case reflect.Float32, reflect.Float64:
			return vv.Float()
		case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
			return vv.Uint()
		default:
			return v
		}
	}
	x = normalize(x)
	y = normalize(y)
	return reflect.DeepEqual(x, y)
}
647676
func equalAny(v1, v2 reflect.Value, prop *Properties) bool {
	if v1.Type() == protoMessageType {
		m1, _ := v1.Interface().(Message)
		m2, _ := v2.Interface().(Message)
		return Equal(m1, m2)
	}
	switch v1.Kind() {
	case reflect.Bool:
		return v1.Bool() == v2.Bool()
	case reflect.Float32, reflect.Float64:
		return v1.Float() == v2.Float()
	case reflect.Int32, reflect.Int64:
		return v1.Int() == v2.Int()
	case reflect.Interface:
		// Probably a oneof field; compare the inner values.
		n1, n2 := v1.IsNil(), v2.IsNil()
		if n1 || n2 {
			return n1 == n2
		}
		e1, e2 := v1.Elem(), v2.Elem()
		if e1.Type() != e2.Type() {
			return false
		}
		return equalAny(e1, e2, nil)
	case reflect.Map:
		if v1.Len() != v2.Len() {
			return false
		}
		for _, key := range v1.MapKeys() {
			val2 := v2.MapIndex(key)
			if !val2.IsValid() {
				// This key was not found in the second map.
				return false
			}
			if !equalAny(v1.MapIndex(key), val2, nil) {
				return false
			}
		}
		return true
	case reflect.Ptr:
		// Maps may have nil values in them, so check for nil.
		if v1.IsNil() && v2.IsNil() {
			return true
		}
		if v1.IsNil() != v2.IsNil() {
			return false
		}
		return equalAny(v1.Elem(), v2.Elem(), prop)
	case reflect.Slice:
		if v1.Type().Elem().Kind() == reflect.Uint8 {
			// short circuit: []byte

			// Edge case: if this is in a proto3 message, a zero length
			// bytes field is considered the zero value.
			if prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 {
				return true
			}
			if v1.IsNil() != v2.IsNil() {
				return false
			}
			return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte))
		}

		if v1.Len() != v2.Len() {
			return false
		}
		for i := 0; i < v1.Len(); i++ {
			if !equalAny(v1.Index(i), v2.Index(i), prop) {
				return false
			}
		}
		return true
	case reflect.String:
		return v1.Interface().(string) == v2.Interface().(string)
	case reflect.Struct:
		return equalStruct(v1, v2)
	case reflect.Uint32, reflect.Uint64:
		return v1.Uint() == v2.Uint()
	}

	// unknown type, so not a protocol buffer
	log.Printf("proto: don't know how to compare %v", v1)
	return false
}
406684
func (o Object) IsCompatible(val interface{}) bool {
	k := reflect.TypeOf(val).Kind()
	return k == reflect.Map || k == reflect.Struct
}
1356517
func (rs Ranges) equiv(right Ranges) (_, _ Ranges, _ bool) {
	// we need to squash rs and right but don't want to change the originals
	switch len(rs) {
	case 0:
	case 1:
		rs = Ranges{rs[0]}
	default:
		rs = Ranges(append([]Value_Range{rs[0], rs[1]}, rs[2:]...)).Sort().Squash()
	}
	switch len(right) {
	case 0:
	case 1:
		right = Ranges{right[0]}
	default:
		right = Ranges(append([]Value_Range{right[0], right[1]}, right[2:]...)).Sort().Squash()
	}
	return rs, right, (&Value_Ranges{Range: rs}).Equal(&Value_Ranges{Range: right})
}
421827
func (id TLFID) Eq(other TLFID) bool {
	return bytes.Equal([]byte(id), []byte(other))
}
998835
func AutoGenerateObjectIDIfNotExistEqual(o1, o2 *AutoGenerateObjectIDIfNotExistOption) bool {
	if o1 != nil {
		return o1.Equal(o2)
	}
	if o2 != nil {
		return o2.Equal(o1)
	}
	return true
}
1182447
func (m *Container) Equal(other interface{}) bool {
	if container, ok := other.(*Container); ok == true {
		if len(m.Accessories) != len(container.Accessories) {
			return false
		}

		for i, a := range m.Accessories {
			if a.Equal(container.Accessories[i]) == false {
				return false
			}
		}
		return true
	}

	return false
}
1255767
func (t SimpleType) Equal(u convert.Equaler) bool {
	other, ok := u.(SimpleType)
	if !ok {
		return false
	}
	if t.DefaultValue != other.DefaultValue {
		return false
	}
	return t.Kind == other.Kind
}
34796
func (e *Event) Interface(key string, i interface{}) *Event {
	if e == nil {
		return e
	}
	if obj, ok := i.(LogObjectMarshaler); ok {
		return e.Object(key, obj)
	}
	e.buf = enc.AppendInterface(enc.AppendKey(e.buf, key), i)
	return e
}
1293636
func eq(m interface{}, value interface{}) (hpredicate, error) {
	switch mapper := m.(type) {
	case toInt:
		return intEQ(mapper, value)
	case toFloat64:
		return float64EQ(mapper, value)
	}
	return nil, fmt.Errorf("eq: unsupported argument: %T", m)
}
31507
func (o *QueryTypeOption) Equal(o2 *QueryTypeOption) bool {
	if o2 == nil {
		return o.value == "prefixLast"
	}
	return o.value == o2.value
}
1074339
func (ref *Reference) IsEqual(other Query) bool {
	r := other.Ref()

	// check app instance
	if ref.database.app != r.database.app {
		return false
	}

	// check location
	if ref.path != r.path {
		return false
	}

	// check queries
	q1, q2 := url.Values{}, url.Values{}
	ref.buildQuery(q1)
	r.buildQuery(q2)
	if len(q1) != len(q2) || q1.Encode() != q2.Encode() {
		return false
	}

	return true
}
165153
func Equal(val1 interface{}, val2 interface{}) bool {
	if val1 == nil || val2 == nil {
		return false
	}
	switch v1 := val1.(type) {
	case UUID:
		if v2, ok := val2.(UUID); ok {
			return v1.Equal(v2)
		}
		return false
	case Timestamp:
		if v2, ok := val2.(Timestamp); ok {
			return v1.Equal(v2)
		}
		return false
	case Array:
		if v2, ok := val2.(Array); ok {
			return v1.Equal(v2)
		}
		return false
	case Struct:
		if v2, ok := val2.(Struct); ok {
			return v1.Equal(v2)
		}
		return false
	case Symbol:
		if v2, ok := val2.(Symbol); ok {
			return v1 == v2
		}
		return false
	case int, int32, int8, int16, int64, float32, float64, uint, uint8, uint16, uint32, uint64:
		return val1 == val2
	case bool:
		return val1 == val2
	case string:
		if v2, ok := val2.(string); ok {
			return v1 == v2
		}
		return false
	case []byte:
		if v2, ok := val2.([]byte); ok {
			return bytes.Compare(v1, v2) == 0
		}
		return false
	default:
		fmt.Println(val1)
		fmt.Println(val2)
		fmt.Println("fix Equal of these two types")
		panic("fix Equal of these two types")
	}
}
860831
func Equiv(o1 interface{}, o2 interface{}) bool {
	if o1 == o2 {
		return true
	}

	// TODO: make sure we have handled interface nils
	if o1 == nil || o2 == nil {
		return false
	}

	if e1, ok := o1.(iseq.Equivable); ok {
		return e1.Equiv(o2)
	}

	if e2, ok := o2.(iseq.Equivable); ok {
		return e2.Equiv(o1)
	}

	return false
}