Correction on merge. Added Get. Added example.

This commit is contained in:
Daniel Gil
2018-05-29 10:10:33 +02:00
parent 01cb3ccd23
commit 6fdaa341ff
7 changed files with 259 additions and 8 deletions

View File

@@ -24,8 +24,8 @@ func (intvls *intervals) calculateOverlapped() []*Interval {
lastMaxHigh := math.MinInt64
for i, intvl := range intvls.Intervals {
if i > 0 {
lowInBetween := isLowInBetween(lastMinLow, lastMaxHigh, intvl.Low, intvl.High) //inBetweenInclusive(lastMinLow, intvl.Low, intvl.High) || inBetweenInclusive(intvl.Low, lastMinLow, lastMaxHigh)
highInBetween := isHighInBetween(lastMinLow, lastMaxHigh, intvl.Low, intvl.High) //inBetweenInclusive(lastMaxHigh, intvl.Low, intvl.High) || inBetweenInclusive(intvl.High, lastMinLow, lastMaxHigh)
lowInBetween := isLowInBetween(lastMinLow, lastMaxHigh, intvl.Low, intvl.High)
highInBetween := isHighInBetween(lastMinLow, lastMaxHigh, intvl.Low, intvl.High)
if lowInBetween || highInBetween {
greaterLow := max(intvl.Low, lastMinLow)
lowerHigh := min(intvl.High, lastMaxHigh)