splited big file into smaller files by functionality

This commit is contained in:
Daniel Gil
2018-05-25 13:02:52 +02:00
parent 941fe9746a
commit 786bcb162b
10 changed files with 308 additions and 175 deletions

16
find.go Normal file
View 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
}