Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Elazar Gershuni committed Mar 6, 2024
1 parent aa08fd2 commit dda5aed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
10 changes: 0 additions & 10 deletions pkg/intervals/interval.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ func (i *Interval) overlaps(other Interval) bool {
return other.End >= i.Start && other.Start <= i.End
}

func (i *Interval) touches(other Interval) bool {
if i.Start > other.End {
return i.Start == other.End+1
}
if other.Start > i.End {
return other.Start == i.End+1
}
return false
}

func (i *Interval) isSubset(other Interval) bool {
return other.Start <= i.Start && other.End >= i.End
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/intervals/intervalset.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func (c *CanonicalIntervalSet) Equal(other CanonicalIntervalSet) bool {
}

// Insert updates the current Set with a new Interval to add
func (s *CanonicalIntervalSet) AddInterval(v Interval) {
set := s.IntervalSet
func (c *CanonicalIntervalSet) AddInterval(v Interval) {
set := c.IntervalSet
left := sort.Search(len(set), func(i int) bool {
return set[i].End >= v.Start-1
})
Expand All @@ -50,7 +50,7 @@ func (s *CanonicalIntervalSet) AddInterval(v Interval) {
if right > 0 && set[right-1].End >= v.Start {
v.End = max(v.End, set[right-1].End)
}
s.IntervalSet = slices.Replace(s.IntervalSet, left, right, v)
c.IntervalSet = slices.Replace(c.IntervalSet, left, right, v)
}

// AddHole updates the current CanonicalIntervalSet object by removing the input Interval from the set
Expand Down

0 comments on commit dda5aed

Please sign in to comment.