Commit a9a791c5 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 82e47bc1
...@@ -160,7 +160,15 @@ func (A PPTreeSubSet) UnionInplace(B PPTreeSubSet) { ...@@ -160,7 +160,15 @@ func (A PPTreeSubSet) UnionInplace(B PPTreeSubSet) {
A.xUnionInplace(B) A.xUnionInplace(B)
} }
// XXX Difference // Difference returns D = PP(A.leafs \ B.leafs)
//
// In other words ... XXX
func (A PPTreeSubSet) Difference(B PPTreeSubSet) PPTreeSubSet {
D := A.Clone()
D.DifferenceInplace(B)
return D
}
// DifferenceInplace sets A = PP(A.leafs \ B.leafs) // DifferenceInplace sets A = PP(A.leafs \ B.leafs)
// //
......
...@@ -128,8 +128,6 @@ func (S *RangeSet) verify() { ...@@ -128,8 +128,6 @@ func (S *RangeSet) verify() {
} }
} }
// XXX Equal
// Clone returns copy of the set. // Clone returns copy of the set.
func (orig *RangeSet) Clone() *RangeSet { func (orig *RangeSet) Clone() *RangeSet {
klon := &RangeSet{} klon := &RangeSet{}
...@@ -137,6 +135,20 @@ func (orig *RangeSet) Clone() *RangeSet { ...@@ -137,6 +135,20 @@ func (orig *RangeSet) Clone() *RangeSet {
return klon return klon
} }
// Equal returns whether A == B.
func (A *RangeSet) Equal(B *RangeSet) bool {
if len(A.rangev) != len(B.rangev) {
return false
}
for i, ra := range A.rangev {
rb := B.rangev[i]
if ra != rb {
return false
}
}
return true
}
func (S RangeSet) String() string { func (S RangeSet) String() string {
s := "{" s := "{"
for i, r := range S.rangev { for i, r := range S.rangev {
......
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