Commit 1cbb2749 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent ecd23f2f
...@@ -36,12 +36,12 @@ type RangeSet struct { ...@@ -36,12 +36,12 @@ type RangeSet struct {
rangev []Range // lo↑ rangev []Range // lo↑
} }
// Add adds Range r to the set of keys. // Add adds Range r to the set of keys. // XXX -> UnionInplace1 ?
func (S *RangeSet) Add(r Range) { func (S *RangeSet) Add(r Range) {
panic("TODO") // XXX panic("TODO") // XXX
} }
// Del removes Range r from the set of keys. // Del removes Range r from the set of keys. // XXX -> DifferenceInplace1 ?
func (S *RangeSet) Del(r Range) { func (S *RangeSet) Del(r Range) {
panic("TODO") // XXX panic("TODO") // XXX
} }
...@@ -70,6 +70,28 @@ func (A *RangeSet) Difference(B *RangeSet) *RangeSet { ...@@ -70,6 +70,28 @@ func (A *RangeSet) Difference(B *RangeSet) *RangeSet {
// XXX Intersection // XXX Intersection
func (A *RangeSet) UnionInplace(B *RangeSet) {
A.verify()
B.verify()
defer A.verify()
// XXX dumb
for _, r := range B.rangev {
A.Add(r)
}
}
func (A *RangeSet) DifferenceInplace(B *RangeSet) {
A.verify()
B.verify()
defer A.verify()
// XXX dumb
for _, r := range B.rangev {
A.Del(r)
}
}
// -------- // --------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment