// Overlaps returns true if the interiors of the two bounding boxes
// have any area in common
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
}
2083
func (os *OverlappingShards) ContainsShard(shardName string) bool {
	for _, l := range os.Left {
		if l.ShardName() == shardName {
			return true
		}
	}
	for _, r := range os.Right {
		if r.ShardName() == shardName {
			return true
		}
	}
	return false
}
4283
func (ipr *IPRange) Overlaps(o *IPRange) bool {
	// if the start of o is less than our start, we need to make sure the end of o
	// is less than our start
	if bytes.Compare([]byte(o.Start), []byte(ipr.Start)) < 0 {
		return bytes.Compare([]byte(o.End), []byte(ipr.Start)) >= 0
	}
	// if the start of o is greater than our end, then no overlap
	if bytes.Compare([]byte(o.Start), []byte(ipr.End)) > 0 {
		return false
	}
	// otherwise, their start is within our range, and thus there is overlap
	return true
}
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
}
1260415
func (g *Geometry) Intersects(other *Geometry) (bool, error) {
	return g.binaryPred("Intersects", cGEOSIntersects, other)
}
1014108
func (pb *Block) OverlapsClosedInterval(mint, maxt int64) bool {
	// The block itself is a half-open interval
	// [pb.meta.MinTime, pb.meta.MaxTime).
	return pb.meta.MinTime <= maxt && mint < pb.meta.MaxTime
}
322074
func (f FileStat) OverlapsTimeRange(min, max int64) bool {
	return f.MinTime <= max && f.MaxTime >= min
}
440730
func (r *RegionSet) overlaps(reference Region, start, end int) (ret []int) {
	for i := start; i < end; i++ {
		if reference == r.regions[i] || reference.Intersects(r.regions[i]) || reference.Covers(r.regions[i]) {
			ret = append(ret, i)
		}
	}
	return
}
1192770
func (b *Bound) Intersects(bound *Bound) bool {

	if (b.ne[0] < bound.sw[0]) ||
		(b.sw[0] > bound.ne[0]) ||
		(b.ne[1] < bound.sw[1]) ||
		(b.sw[1] > bound.ne[1]) {
		return false
	}

	return true
}
203047
func OverlappingBinsFor(beg, end int) []uint32 {
	end--
	list := []uint32{level0}
	for _, r := range []struct {
		offset, shift uint32
	}{
		{level1, level1Shift},
		{level2, level2Shift},
		{level3, level3Shift},
		{level4, level4Shift},
		{level5, level5Shift},
	} {
		for k := r.offset + uint32(beg>>r.shift); k <= r.offset+uint32(end>>r.shift); k++ {
			list = append(list, k)
		}
	}
	return list
}
1098701
func (v *Value) HasSpaces() bool {
	return v.Spaces != nil && len(*v.Spaces) > 0
}
1273205
func (c Collision) Bounds() coord.Bounds {
	return coord.JoinBounds(c.A.Bounds(), c.B.Bounds())
}
1050796
func (mc *memChunk) OverlapsClosedInterval(mint, maxt int64) bool {
	return mc.minTime <= maxt && mint <= mc.maxTime
}
1023071
func containsCenterMatches(a *clippedShape, target crossingTarget) bool {
	return (!a.containsCenter && target == crossingTargetDontCross) ||
		(a.containsCenter && target == crossingTargetCross)
}
1054844
func intersectInterval16s(a, b interval16) (res interval16, isEmpty bool) {
	if !haveOverlap16(a, b) {
		isEmpty = true
		return
	}
	if b.start > a.start {
		res.start = b.start
	} else {
		res.start = a.start
	}

	bEnd := b.last()
	aEnd := a.last()
	var resEnd uint16

	if bEnd < aEnd {
		resEnd = bEnd
	} else {
		resEnd = aEnd
	}
	res.length = resEnd - res.start
	return
}
510943
func intersectArrays(orig, tgt []string) bool {
	for _, i := range orig {
		for _, x := range tgt {
			if i == x {
				return true
			}
		}
	}
	return false
}
232949
func (s *PortSpec) Overlaps(p *PortSpec) bool {
	a := p
	b := s
	if a.Min > b.Min {
		a = s
		b = p
	}
	if a.Max >= b.Min {
		return true
	}
	return false
}