MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / Normalize

Method Normalize

IceFireDB-SQLite/pkg/mysql/mysql/mysql_gtid.go:86–108  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

84}
85
86func (s IntervalSlice) Normalize() IntervalSlice {
87 var n IntervalSlice
88 if len(s) == 0 {
89 return n
90 }
91
92 s.Sort()
93
94 n = append(n, s[0])
95
96 for i := 1; i < len(s); i++ {
97 last := n[len(n)-1]
98 if s[i].Start > last.Stop {
99 n = append(n, s[i])
100 continue
101 } else {
102 stop := max(last.Stop, s[i].Stop)
103 n[len(n)-1] = Interval{last.Start, stop}
104 }
105 }
106
107 return n
108}
109
110// Contain returns true if sub in s
111func (s IntervalSlice) Contain(sub IntervalSlice) bool {

Callers 5

ParseUUIDSetFunction · 0.45
NewUUIDSetFunction · 0.45
AddIntervalMethod · 0.45
CloneMethod · 0.45

Calls 1

SortMethod · 0.95

Tested by 1