fixed gaps calculations

This commit is contained in:
Daniel Gil
2018-05-24 18:45:37 +02:00
parent 7255f129f5
commit 941fe9746a
2 changed files with 48 additions and 18 deletions

View File

@@ -18,3 +18,10 @@ type ByLow []*Interval
func (itvls ByLow) Len() int { return len(itvls) }
func (itvls ByLow) Swap(i, j int) { itvls[i], itvls[j] = itvls[j], itvls[i] }
func (itvls ByLow) Less(i, j int) bool { return itvls[i].Low < itvls[j].Low }
// ByHigh implements sort.Interface for []Interval based on the High field.
type ByHigh []*Interval
func (itvls ByHigh) Len() int { return len(itvls) }
func (itvls ByHigh) Swap(i, j int) { itvls[i], itvls[j] = itvls[j], itvls[i] }
func (itvls ByHigh) Less(i, j int) bool { return itvls[i].High > itvls[j].High }