// OverlappingShardsForShard returns the OverlappingShards object
// from the list that has he provided shard, or nil
768834
func OverlappingShardsForShard(os []*OverlappingShards, shardName string) *OverlappingShards {
	for _, o := range os {
		if o.ContainsShard(shardName) {
			return o
		}
	}
	return nil
}
937670
func (s *rowSegment) Difference(other *rowSegment) *rowSegment {
	data := s.data.Difference(&other.data)

	return &rowSegment{
		data:  *data,
		shard: s.shard,
		n:     data.Count(),
	}
}
331427
func (f FileStat) OverlapsKeyRange(min, max []byte) bool {
	return len(min) != 0 && len(max) != 0 && bytes.Compare(f.MinKey, max) <= 0 && bytes.Compare(f.MaxKey, min) >= 0
}
757264
func Shard(str string, width int, depth int, restOnly bool) []string {
	var results []string

	for i := 0; i < depth; i++ {
		results = append(results, str[(width*i):(width*(i+1))])
	}

	if restOnly {
		results = append(results, str[(width*depth):])
	} else {
		results = append(results, str)
	}

	return results
}
224776
func keyspaceShardsToSets(list string) (map[string]bool, map[string]bool) {
	keyspaces := make(map[string]bool)
	shards := make(map[string]bool)
	if list == "" {
		return keyspaces, shards
	}

	for _, item := range strings.Split(list, ",") {
		if strings.Contains(item, "/") {
			shards[item] = true
		} else {
			keyspaces[item] = true
		}
	}
	return keyspaces, shards
}
880971
func trimShards(in [][]byte, size int) [][]byte {
	for i := range in {
		if in[i] != nil {
			in[i] = in[i][0:size]
		}
		if len(in[i]) < size {
			in[i] = nil
		}
	}
	return in
}
1296667
func (e *executor) executeDifferenceShard(ctx context.Context, index string, c *pql.Call, shard uint64) (*Row, error) {
	span, ctx := tracing.StartSpanFromContext(ctx, "Executor.executeDifferenceShard")
	defer span.Finish()

	var other *Row
	if len(c.Children) == 0 {
		return nil, fmt.Errorf("empty Difference query is currently not supported")
	}
	for i, input := range c.Children {
		row, err := e.executeBitmapCallShard(ctx, index, input, shard)
		if err != nil {
			return nil, err
		}

		if i == 0 {
			other = row
		} else {
			other = other.Difference(row)
		}
	}
	other.invalidateCount()
	return other, nil
}
780367
func (g *Geometry) Overlaps(other *Geometry) (bool, error) {
	return g.binaryPred("Overlaps", cGEOSOverlaps, other)
}
981654
func OverflowShardBits(rowID int64, shardRowIDBits uint64) bool {
	mask := (1<<shardRowIDBits - 1) << (64 - shardRowIDBits - 1)
	return rowID&int64(mask) > 0
}
240966
func getOverlappingReplicaSets(c client.ReplicaSetInterface, rs *extensions.ReplicaSet) ([]extensions.ReplicaSet, []extensions.ReplicaSet, error) {
	var overlappingRSs, exactMatchRSs []extensions.ReplicaSet
	return overlappingRSs, exactMatchRSs, nil
}
183197
func (r reedSolomon) checkSomeShards(matrixRows, inputs, toCheck [][]byte, outputCount, byteCount int) bool {
	if r.o.maxGoroutines > 1 && byteCount > r.o.minSplitSize {
		return r.checkSomeShardsP(matrixRows, inputs, toCheck, outputCount, byteCount)
	}
	outputs := make([][]byte, len(toCheck))
	for i := range outputs {
		outputs[i] = make([]byte, byteCount)
	}
	for c := 0; c < r.DataShards; c++ {
		in := inputs[c]
		for iRow := 0; iRow < outputCount; iRow++ {
			galMulSliceXor(matrixRows[iRow][c], in, outputs[iRow], &r.o)
		}
	}

	for i, calc := range outputs {
		if !bytes.Equal(calc, toCheck[i]) {
			return false
		}
	}
	return true
}
851737
func (t *tFile) overlaps(icmp *iComparer, umin, umax []byte) bool {
	return !t.after(icmp, umin) && !t.before(icmp, umax)
}
737274
func (containers Containers) stripProvisioningDuplicates() (deduplicated Containers) {
	seenProvisioningKeys := make(map[string]bool)
	for _, container := range containers {
		// for 2 containers that would the same provisioning
		// commands, the key should be equal
		key := container.BuildParams().Context() + "#" + container.Image()
		if _, ok := seenProvisioningKeys[key]; !ok {
			deduplicated = append(deduplicated, container)
			seenProvisioningKeys[key] = true
		}
	}
	return
}
316912
func (tf tFiles) overlaps(icmp *iComparer, umin, umax []byte, unsorted bool) bool {
	if unsorted {
		// Check against all files.
		for _, t := range tf {
			if t.overlaps(icmp, umin, umax) {
				return true
			}
		}
		return false
	}

	i := 0
	if len(umin) > 0 {
		// Find the earliest possible internal key for min.
		i = tf.searchMax(icmp, makeInternalKey(nil, umin, keyMaxSeq, keyTypeSeek))
	}
	if i >= len(tf) {
		// Beginning of range is after all files, so no overlap.
		return false
	}
	return !tf[i].before(icmp, umax)
}
547888
func (bb BoundingBox) Overlaps(test BoundingBox) bool {
	bblen := len(bb)
	testlen := len(test)

	if (bblen == 0) || (testlen == 0) || (bblen != testlen) {
		return false
	}
	result := true
	bbDimensions := bblen / 2
	if bb.Antimeridian() && test.Antimeridian() {
		// no op
	} else if bb.Antimeridian() {
		result = result && ((test[bbDimensions] >= bb[0]) && (test[bbDimensions] <= 180) ||
			(test[0] <= bb[bbDimensions]) && (test[0] >= -180))
	} else if test.Antimeridian() {
		result = result && ((bb[bbDimensions] >= test[0]) && (bb[bbDimensions] <= 180) ||
			(bb[0] <= test[bbDimensions]) && (bb[0] >= -180))
	} else {
		result = result && (bb[0] < test[bbDimensions]) && (bb[bbDimensions] > test[0])
	}
	result = result && (bb[1] < test[1+bbDimensions]) && (bb[1+bbDimensions] > test[1])
	if bbDimensions > 2 {
		result = result && (bb[2] < test[2+bbDimensions]) && (bb[2+bbDimensions] > test[2])
	}
	return result
}
135484
func (tr Ranges) Overlaps(r Range) bool {
	if r.IsEmpty() {
		return false
	}
	e := tr.findFirstNotBefore(r)
	if e == nil {
		return false
	}
	lr := e.Value.(Range)
	return lr.Overlaps(r)
}
1226431
func (r Rule) overlaps(o Rule) bool {
	if !(r.Layer == o.Layer || o.Layer == "") {
		return false
	}
	if !(r.Attachment == o.Attachment || o.Attachment == "") {
		return false
	}
	// if !(r.Class == o.Class || o.Class == "") {
	// 	return false
	// }
	if !(r.Zoom.combine(o.Zoom).Levels() > 0 || r.Zoom == o.Zoom) {
		return false
	}
	if !filterOverlap(o.Filters, r.Filters) {
		return false
	}
	return true
}