splited big file into smaller files by functionality
This commit is contained in:
16
find.go
Normal file
16
find.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package interval
|
||||
|
||||
func (intvls *intervals) FindIntervalsForValue(value int) []*Interval {
|
||||
intvls.Sort()
|
||||
var matches []*Interval
|
||||
for _, intvl := range intvls.Intervals {
|
||||
if intvl.Low > value {
|
||||
// due to the intervals are sorted, we can confirm that we will not find more matches
|
||||
break
|
||||
}
|
||||
if inBetweenInclusive(value, intvl.Low, intvl.High) {
|
||||
matches = append(matches, intvl)
|
||||
}
|
||||
}
|
||||
return matches
|
||||
}
|
||||
Reference in New Issue
Block a user