mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
adt: Union for interval trees
This commit is contained in:
@@ -485,6 +485,15 @@ func (ivt *IntervalTree) Stab(iv Interval) (ivs []*IntervalValue) {
|
||||
return ivs
|
||||
}
|
||||
|
||||
// Union merges a given interval tree into the receiver.
|
||||
func (ivt *IntervalTree) Union(inIvt IntervalTree, ivl Interval) {
|
||||
f := func(n *IntervalValue) bool {
|
||||
ivt.Insert(n.Ivl, n.Val)
|
||||
return true
|
||||
}
|
||||
inIvt.Visit(ivl, f)
|
||||
}
|
||||
|
||||
type StringComparable string
|
||||
|
||||
func (s StringComparable) Compare(c Comparable) int {
|
||||
|
||||
Reference in New Issue
Block a user