//compare two vectors by value.
483859
func Equals(v1, v2 Vect) bool {
	return v1.X == v2.X && v1.Y == v2.Y
}
985805
func ValuesEqual(v1, v2 Value) bool {
	switch v1 := v2.(type) {
	case Document:
		v2, ok := v2.(Document)
		if !ok || len(v1) != len(v2) {
			return false
		}
		for k, s1 := range v1 {
			if s2, ok := v2[k]; !ok || !ValuesEqual(s1, s2) {
				return false
			}
		}
		return true
	case Strings:
		v2, ok := v2.(Strings)
		if !ok || len(v1) != len(v2) {
			return false
		}
		for i := range v1 {
			if v1[i] != v2[i] {
				return false
			}
		}
		return true
	case Bytes:
		v2, ok := v2.(Bytes)
		if !ok || len(v1) != len(v2) {
			return false
		}
		return bytes.Equal(v1, v2)
	case Time:
		v2, ok := v2.(Time)
		if !ok {
			return false
		}
		return time.Time(v1).Equal(time.Time(v2))
	}
	return v1 == v2
}
1159114
func Equal(l, r Value) (bool, error) {

	if l == nil && r == nil {
		return true, nil
	}

	if r == nil {
		switch l.(type) {
		case NilValue:
			return true, nil
		}
		return false, nil
	}
	if _, isNil := r.(NilValue); isNil {
		switch l.(type) {
		case nil:
			return true, nil
		case NilValue:
			return true, nil
		}
		return false, nil
	}

	switch lt := l.(type) {
	case nil, NilValue:
		return false, nil
	case StringValue:
		if lt.Val() == r.ToString() {
			return true, nil
		}
		return false, nil
	case IntValue:
		rhv, _ := ValueToInt64(r)
		return lt.Val() == rhv, nil
	case NumberValue:
		rhv, _ := ValueToFloat64(r)
		return lt.Val() == rhv, nil
	case BoolValue:
		rhv, _ := ValueToBool(r)
		return lt.Val() == rhv, nil
	case TimeValue:
		rhv, _ := ValueToTime(r)
		return lt.Val() == rhv, nil
	case Slice:
		if rhv, ok := r.(Slice); ok {
			if lt.Len() != rhv.Len() {
				return false, nil
			}
			rhslice := rhv.SliceValue()
			for i, lhval := range lt.SliceValue() {
				if eq, err := Equal(lhval, rhslice[i]); !eq || err != nil {
					return false, nil
				}
			}
			return true, nil
		}
	}
	return false, fmt.Errorf("Could not evaluate equals for %v = %v", l.Value(), r.Value())
}
818357
func (w *With) Compare(other *With) int {
	if w == nil {
		if other == nil {
			return 0
		}
		return -1
	} else if other == nil {
		return 1
	}
	if cmp := Compare(w.Target, other.Target); cmp != 0 {
		return cmp
	}
	return Compare(w.Value, other.Value)
}
118575
func (rule *Rule) Compare(other *Rule) int {
	if rule == nil {
		if other == nil {
			return 0
		}
		return -1
	} else if other == nil {
		return 1
	}
	if cmp := rule.Head.Compare(other.Head); cmp != 0 {
		return cmp
	}
	if cmp := util.Compare(rule.Default, other.Default); cmp != 0 {
		return cmp
	}
	if cmp := rule.Body.Compare(other.Body); cmp != 0 {
		return cmp
	}
	return rule.Else.Compare(other.Else)
}
1346851
func compare(nodeLow, ivLow int64, nodeID, ivID uint64) int {
	if ivLow > nodeLow {
		return 1
	}

	if ivLow < nodeLow {
		return 0
	}

	return intFromBool(ivID > nodeID)
}
684159
func (l *State) Compare(index1, index2 int, op ComparisonOperator) bool {
	if o1, o2 := l.indexToValue(index1), l.indexToValue(index2); o1 != nil && o2 != nil {
		switch op {
		case OpEq:
			return l.equalObjects(o1, o2)
		case OpLT:
			return l.lessThan(o1, o2)
		case OpLE:
			return l.lessOrEqual(o1, o2)
		default:
			panic("invalid option")
		}
	}
	return false
}
845307
func (vs Values) Values() []float64 {
	values := make([]float64, len(vs))
	for index, v := range vs {
		values[index] = v.Value
	}
	return values
}
1205336
func Compare(a, b interface{}) Diff {
	mapA := map[string]interface{}{}
	mapB := map[string]interface{}{}

	jsonA, _ := json.Marshal(a)
	jsonB, _ := json.Marshal(b)

	json.Unmarshal(jsonA, &mapA)
	json.Unmarshal(jsonB, &mapB)

	return compareStringMaps(mapA, mapB)
}
80790
func (s *set) Compare(other Value) int {
	o1 := sortOrder(s)
	o2 := sortOrder(other)
	if o1 < o2 {
		return -1
	} else if o1 > o2 {
		return 1
	}
	t := other.(*set)
	sort.Sort(termSlice(s.keys))
	sort.Sort(termSlice(t.keys))
	return termSliceCompare(s.keys, t.keys)
}
1193812
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 a == b
	}
	if reflect.DeepEqual(a, b) {
		return true
	}
	aValue := reflect.ValueOf(a)
	bValue := reflect.ValueOf(b)
	if aValue == bValue {
		return true
	}

	// Attempt comparison after type conversion
	if bValue.Type().ConvertibleTo(aValue.Type()) {
		return reflect.DeepEqual(a, bValue.Convert(aValue.Type()).Interface())
	}
	// Last ditch effort
	if fmt.Sprintf("%#v", a) == fmt.Sprintf("%#v", b) {
		return true
	}

	return false
}
367038
func compare(x, y string) bool {
	return subtle.ConstantTimeCompare([]byte(x), []byte(y)) == 1
}
285715
func FloatSliceEquals(a []float64, b []float64) bool {
	if len(a) != len(b) {
		return false
	}

	for i, aValue := range a {
		bValue := b[i]

		if !FloatEquals(aValue, bValue) {
			return false
		}
	}

	return true
}
643752
func (obj *object) Compare(other Value) int {
	o1 := sortOrder(obj)
	o2 := sortOrder(other)
	if o1 < o2 {
		return -1
	} else if o2 < o1 {
		return 1
	}
	a := obj
	b := other.(*object)
	keysA := a.Keys()
	keysB := b.Keys()
	sort.Sort(termSlice(keysA))
	sort.Sort(termSlice(keysB))
	minLen := a.Len()
	if b.Len() < a.Len() {
		minLen = b.Len()
	}
	for i := 0; i < minLen; i++ {
		keysCmp := Compare(keysA[i], keysB[i])
		if keysCmp < 0 {
			return -1
		}
		if keysCmp > 0 {
			return 1
		}
		valA := a.Get(keysA[i])
		valB := b.Get(keysB[i])
		valCmp := Compare(valA, valB)
		if valCmp != 0 {
			return valCmp
		}
	}
	if a.Len() < b.Len() {
		return -1
	}
	if b.Len() < a.Len() {
		return 1
	}
	return 0
}
215831
func (h *Histogram) Equals(other *Histogram) bool {
	switch {
	case
		h.lowestTrackableValue != other.lowestTrackableValue,
		h.highestTrackableValue != other.highestTrackableValue,
		h.unitMagnitude != other.unitMagnitude,
		h.significantFigures != other.significantFigures,
		h.subBucketHalfCountMagnitude != other.subBucketHalfCountMagnitude,
		h.subBucketHalfCount != other.subBucketHalfCount,
		h.subBucketMask != other.subBucketMask,
		h.subBucketCount != other.subBucketCount,
		h.bucketCount != other.bucketCount,
		h.countsLen != other.countsLen,
		h.totalCount != other.totalCount:
		return false
	default:
		for i, c := range h.counts {
			if c != other.counts[i] {
				return false
			}
		}
	}
	return true
}
145552
func (v Var) Equal(other Value) bool {
	switch other := other.(type) {
	case Var:
		return v == other
	default:
		return false
	}
}
444851
func ValuesEqual(vss1, vss2 [][]*querypb.Value) bool {
	if len(vss1) != len(vss2) {
		return false
	}
	for i, vs1 := range vss1 {
		if len(vs1) != len(vss2[i]) {
			return false
		}
		for j, v1 := range vs1 {
			if !proto.Equal(v1, vss2[i][j]) {
				return false
			}
		}
	}
	return true
}