// CompareSliceStrU compares two 'string' type slices.
// It returns true if elements are the same, and ignores the order.
323126
func CompareSliceStrU(s1, s2 []string) bool {
	if len(s1) != len(s2) {
		return false
	}

	for i := range s1 {
		for j := len(s2) - 1; j >= 0; j-- {
			if s1[i] == s2[j] {
				s2 = append(s2[:j], s2[j+1:]...)
				break
			}
		}
	}
	if len(s2) > 0 {
		return false
	}
	return true
}
1359778
func recordsSliceEquals(l, r []Record) bool {
	if len(l) != len(r) {
		return false
	}
	for i := range l {
		if l[i] != r[i] {
			return false
		}
	}
	return true
}
69292
func ByteSlices(reply interface{}, err error) ([][]byte, error) {
	var result [][]byte
	err = sliceHelper(reply, err, "ByteSlices", func(n int) { result = make([][]byte, n) }, func(i int, v interface{}) error {
		p, ok := v.([]byte)
		if !ok {
			return fmt.Errorf("redigo: unexpected element type for ByteSlices, got type %T", v)
		}
		result[i] = p
		return nil
	})
	return result, err
}
131223
func (p *SortKeys) AsStringSliceComparator() StringSliceComparator {
	numeric := utils.NewIndex(p.Numeric)
	reverseIndex := utils.NewIndex(p.Reversed)
	comparators := make([]StringComparator, len(p.Keys))
	for i, k := range p.Keys {
		if numeric.Contains(k) {
			comparators[i] = LessNumericStrings
		} else {
			comparators[i] = LessStrings
		}
		if reverseIndex.Contains(k) {
			f := comparators[i]
			comparators[i] = func(l, r string) bool {
				return !f(l, r)
			}
		}
	}
	return AsStringSliceComparator(comparators)
}
1123141
func (s String) Equals(other DxfElement) bool {
	if sStr, ok := other.(*String); ok {
		return s.value == sStr.value
	}
	return false
}
702306
func (s StringSlice) StringSlice() []string {
	ss := []string{}
	for _, tmp := range s {
		if len(tmp) <= 2 {
			continue
		}
		ss = append(ss, tmp)
	}
	return ss
}
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
}
798003
func ComparePDFFiles(file1Str, file2Str string, printDiff bool) (err error) {
	var sl1, sl2 []byte
	sl1, err = ioutil.ReadFile(file1Str)
	if err == nil {
		sl2, err = ioutil.ReadFile(file2Str)
		if err == nil {
			err = CompareBytes(sl1, sl2, printDiff)
		} else {
			// Second file is missing; treat this as success
			err = nil
		}
	}
	return
}
686509
func similar(str string, candidates []string) string {
	for _, candidate := range candidates {
		if strings.EqualFold(str, candidate) {
			return candidate
		}
	}
	return ""
}
1063249
func equalSlice(a, e reflect.Value) bool {
	if a.IsNil() != e.IsNil() {
		return false
	}
	if a.IsNil() && e.IsNil() {
		return true
	}
	if a.Len() != e.Len() {
		return false
	}
	for i := 0; i < a.Len(); i++ {
		valA := a.Index(i)
		valE := e.Index(i)

		glog.V(10).Infof("comparing slices: %d %v %v", i, valA, valE)

		if !equalFieldValues(valA, valE) {
			glog.V(4).Infof("unequal slice value: %d %v %v", i, valA, valE)
			return false
		}
	}
	return true
}
601358
func StringSliceEqual(a, b []string) bool {
	if len(a) != len(b) {
		return false
	}
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			return false
		}
	}
	return true
}
39117
func IsSliceContainsStr(sl []string, str string) bool {
	str = strings.ToLower(str)
	for _, s := range sl {
		if strings.ToLower(s) == str {
			return true
		}
	}
	return false
}
664779
func CompareBytes(sl1, sl2 []byte, printDiff bool) (err error) {
	var posStart, posEnd, len1, len2, length int
	var diffs bool

	len1 = len(sl1)
	len2 = len(sl2)
	length = len1
	if length > len2 {
		length = len2
	}
	for posStart < length-1 {
		posEnd = posStart + 16
		if posEnd > length {
			posEnd = length
		}
		if !checkBytes(posStart, sl1[posStart:posEnd], sl2[posStart:posEnd], printDiff) {
			diffs = true
		}
		posStart = posEnd
	}
	if diffs {
		err = fmt.Errorf("documents are different")
	}
	return
}
145460
func (v VertexSlice) Equals(other VertexSlice) bool {
	if len(v) != len(other) {
		return false
	}

	for i, vertex := range v {
		otherVertex := other[i]

		if !vertex.Equals(otherVertex) {
			return false
		}
	}

	return true
}
630095
func (e LineElement) Equals(other LineElement) bool {
	return core.FloatEquals(e.Length, other.Length) &&
		e.AbsoluteRotation == other.AbsoluteRotation &&
		e.IsTextString == other.IsTextString &&
		e.IsShape == other.IsShape &&
		e.ShapeNumber == other.ShapeNumber &&
		core.FloatEquals(e.Scale, other.Scale) &&
		core.FloatEquals(e.RotationAngle, other.RotationAngle) &&
		core.FloatEquals(e.XOffset, other.XOffset) &&
		core.FloatEquals(e.YOffset, other.YOffset) &&
		e.Text == other.Text
}
345018
func StringBoolToSlices(m map[string]bool) (keys []string, values []bool) {
	if m == nil {
		return nil, nil
	}
	for k, v := range m {
		keys = append(keys, k)
		values = append(values, v)
	}
	return keys, values
}
171259
func StringSlicePos(slice []string, value string) int {
	for p, v := range slice {
		if v == value {
			return p
		}
	}
	return -1
}