mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-30 03:20:18 -06:00
Merge pull request #801 from arv/remove-set-substract
Remove Set Subtract
This commit is contained in:
@@ -594,10 +594,6 @@ func (s SetOfString) Union(others ...SetOfString) SetOfString {
|
||||
return SetOfString{s.s.Union(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfString) Subtract(others ...SetOfString) SetOfString {
|
||||
return SetOfString{s.s.Subtract(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfString) First() string {
|
||||
return s.s.First().(types.String).String()
|
||||
}
|
||||
|
||||
@@ -737,10 +737,6 @@ func (s SetOfString) Union(others ...SetOfString) SetOfString {
|
||||
return SetOfString{s.s.Union(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfString) Subtract(others ...SetOfString) SetOfString {
|
||||
return SetOfString{s.s.Subtract(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfString) First() string {
|
||||
return s.s.First().(types.String).String()
|
||||
}
|
||||
@@ -887,10 +883,6 @@ func (s SetOfRefOfRound) Union(others ...SetOfRefOfRound) SetOfRefOfRound {
|
||||
return SetOfRefOfRound{s.s.Union(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfRound) Subtract(others ...SetOfRefOfRound) SetOfRefOfRound {
|
||||
return SetOfRefOfRound{s.s.Subtract(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfRound) First() RefOfRound {
|
||||
return s.s.First().(RefOfRound)
|
||||
}
|
||||
|
||||
@@ -1049,10 +1049,6 @@ func (s SetOfRoundRaise) Union(others ...SetOfRoundRaise) SetOfRoundRaise {
|
||||
return SetOfRoundRaise{s.s.Union(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRoundRaise) Subtract(others ...SetOfRoundRaise) SetOfRoundRaise {
|
||||
return SetOfRoundRaise{s.s.Subtract(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRoundRaise) First() RoundRaise {
|
||||
return s.s.First().(RoundRaise)
|
||||
}
|
||||
|
||||
@@ -737,10 +737,6 @@ func (s SetOfString) Union(others ...SetOfString) SetOfString {
|
||||
return SetOfString{s.s.Union(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfString) Subtract(others ...SetOfString) SetOfString {
|
||||
return SetOfString{s.s.Subtract(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfString) First() string {
|
||||
return s.s.First().(types.String).String()
|
||||
}
|
||||
@@ -887,10 +883,6 @@ func (s SetOfRefOfRound) Union(others ...SetOfRefOfRound) SetOfRefOfRound {
|
||||
return SetOfRefOfRound{s.s.Union(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfRound) Subtract(others ...SetOfRefOfRound) SetOfRefOfRound {
|
||||
return SetOfRefOfRound{s.s.Subtract(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfRound) First() RefOfRound {
|
||||
return s.s.First().(RefOfRound)
|
||||
}
|
||||
|
||||
@@ -594,10 +594,6 @@ func (s SetOfString) Union(others ...SetOfString) SetOfString {
|
||||
return SetOfString{s.s.Union(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfString) Subtract(others ...SetOfString) SetOfString {
|
||||
return SetOfString{s.s.Subtract(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfString) First() string {
|
||||
return s.s.First().(types.String).String()
|
||||
}
|
||||
|
||||
@@ -715,10 +715,6 @@ func (s SetOfRefOfRemotePhoto) Union(others ...SetOfRefOfRemotePhoto) SetOfRefOf
|
||||
return SetOfRefOfRemotePhoto{s.s.Union(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfRemotePhoto) Subtract(others ...SetOfRefOfRemotePhoto) SetOfRefOfRemotePhoto {
|
||||
return SetOfRefOfRemotePhoto{s.s.Subtract(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfRemotePhoto) First() RefOfRemotePhoto {
|
||||
return s.s.First().(RefOfRemotePhoto)
|
||||
}
|
||||
|
||||
@@ -612,10 +612,6 @@ func (s SetOfRemotePhoto) Union(others ...SetOfRemotePhoto) SetOfRemotePhoto {
|
||||
return SetOfRemotePhoto{s.s.Union(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRemotePhoto) Subtract(others ...SetOfRemotePhoto) SetOfRemotePhoto {
|
||||
return SetOfRemotePhoto{s.s.Subtract(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRemotePhoto) First() RemotePhoto {
|
||||
return s.s.First().(RemotePhoto)
|
||||
}
|
||||
@@ -884,10 +880,6 @@ func (s SetOfRefOfRemotePhoto) Union(others ...SetOfRefOfRemotePhoto) SetOfRefOf
|
||||
return SetOfRefOfRemotePhoto{s.s.Union(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfRemotePhoto) Subtract(others ...SetOfRefOfRemotePhoto) SetOfRefOfRemotePhoto {
|
||||
return SetOfRefOfRemotePhoto{s.s.Subtract(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfRemotePhoto) First() RefOfRemotePhoto {
|
||||
return s.s.First().(RefOfRemotePhoto)
|
||||
}
|
||||
|
||||
@@ -594,10 +594,6 @@ func (s SetOfString) Union(others ...SetOfString) SetOfString {
|
||||
return SetOfString{s.s.Union(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfString) Subtract(others ...SetOfString) SetOfString {
|
||||
return SetOfString{s.s.Subtract(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfString) First() string {
|
||||
return s.s.First().(types.String).String()
|
||||
}
|
||||
|
||||
@@ -594,10 +594,6 @@ func (s SetOfString) Union(others ...SetOfString) SetOfString {
|
||||
return SetOfString{s.s.Union(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfString) Subtract(others ...SetOfString) SetOfString {
|
||||
return SetOfString{s.s.Subtract(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfString) First() string {
|
||||
return s.s.First().(types.String).String()
|
||||
}
|
||||
|
||||
@@ -268,10 +268,6 @@ func (s SetOfRefOfRemotePhoto) Union(others ...SetOfRefOfRemotePhoto) SetOfRefOf
|
||||
return SetOfRefOfRemotePhoto{s.s.Union(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfRemotePhoto) Subtract(others ...SetOfRefOfRemotePhoto) SetOfRefOfRemotePhoto {
|
||||
return SetOfRefOfRemotePhoto{s.s.Subtract(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfRemotePhoto) First() RefOfRemotePhoto {
|
||||
return s.s.First().(RefOfRemotePhoto)
|
||||
}
|
||||
|
||||
@@ -396,10 +396,6 @@ func (s SetOfRefOfCommit) Union(others ...SetOfRefOfCommit) SetOfRefOfCommit {
|
||||
return SetOfRefOfCommit{s.s.Union(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfCommit) Subtract(others ...SetOfRefOfCommit) SetOfRefOfCommit {
|
||||
return SetOfRefOfCommit{s.s.Subtract(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfCommit) First() RefOfCommit {
|
||||
return s.s.First().(RefOfCommit)
|
||||
}
|
||||
|
||||
@@ -128,10 +128,6 @@ func (s {{.Name}}) Union(others ...{{.Name}}) {{.Name}} {
|
||||
return {{.Name}}{s.s.Union(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s {{.Name}}) Subtract(others ...{{.Name}}) {{.Name}} {
|
||||
return {{.Name}}{s.s.Subtract(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s {{.Name}}) First() {{userType .ElemType}} {
|
||||
return {{valueToUser "s.s.First()" .ElemType}}
|
||||
}
|
||||
|
||||
@@ -710,10 +710,6 @@ func (s SetOfFloat32) Union(others ...SetOfFloat32) SetOfFloat32 {
|
||||
return SetOfFloat32{s.s.Union(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfFloat32) Subtract(others ...SetOfFloat32) SetOfFloat32 {
|
||||
return SetOfFloat32{s.s.Subtract(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfFloat32) First() float32 {
|
||||
return float32(s.s.First().(types.Float32))
|
||||
}
|
||||
|
||||
@@ -134,10 +134,6 @@ func (s SetOfBool) Union(others ...SetOfBool) SetOfBool {
|
||||
return SetOfBool{s.s.Union(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfBool) Subtract(others ...SetOfBool) SetOfBool {
|
||||
return SetOfBool{s.s.Subtract(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfBool) First() bool {
|
||||
return bool(s.s.First().(types.Bool))
|
||||
}
|
||||
|
||||
@@ -397,10 +397,6 @@ func (s SetOfUint8) Union(others ...SetOfUint8) SetOfUint8 {
|
||||
return SetOfUint8{s.s.Union(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfUint8) Subtract(others ...SetOfUint8) SetOfUint8 {
|
||||
return SetOfUint8{s.s.Subtract(s.fromStructSlice(others)...), s.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfUint8) First() uint8 {
|
||||
return uint8(s.s.First().(types.Uint8))
|
||||
}
|
||||
|
||||
@@ -133,10 +133,6 @@ func (s SetOfRefOfPackage) Union(others ...SetOfRefOfPackage) SetOfRefOfPackage
|
||||
return SetOfRefOfPackage{s.s.Union(s.fromStructSlice(others)...), &ref.Ref{}, s.cs}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfPackage) Subtract(others ...SetOfRefOfPackage) SetOfRefOfPackage {
|
||||
return SetOfRefOfPackage{s.s.Subtract(s.fromStructSlice(others)...), &ref.Ref{}, s.cs}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfPackage) First() RefOfPackage {
|
||||
return s.s.First().(RefOfPackage)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ type Set interface {
|
||||
Insert(values ...Value) Set
|
||||
Remove(values ...Value) Set
|
||||
Union(others ...Set) Set
|
||||
Subtract(others ...Set) Set
|
||||
Iter(cb setIterCallback)
|
||||
IterAll(cb setIterAllCallback)
|
||||
IterAllP(concurrency int, f setIterAllCallback)
|
||||
|
||||
@@ -60,17 +60,6 @@ func (s setLeaf) Union(others ...Set) Set {
|
||||
return setUnion(s, s.cs, others)
|
||||
}
|
||||
|
||||
func (s setLeaf) Subtract(others ...Set) Set {
|
||||
var result Set = s
|
||||
for _, other := range others {
|
||||
other.Iter(func(v Value) (stop bool) {
|
||||
result = result.Remove(v)
|
||||
return
|
||||
})
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func (s setLeaf) Iter(cb setIterCallback) {
|
||||
for _, v := range s.data {
|
||||
if cb(v) {
|
||||
|
||||
@@ -116,15 +116,6 @@ func TestSetUnion(t *testing.T) {
|
||||
assert.True(NewSet(cs, Int32(1)).Union().Equals(NewSet(cs, Int32(1))))
|
||||
}
|
||||
|
||||
func TestSetSubtract(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
cs := chunks.NewMemoryStore()
|
||||
assert.True(NewSet(cs, Int32(-1), Int32(0), Int32(1)).Subtract(
|
||||
NewSet(cs, Int32(0), Int32(-1)),
|
||||
NewSet(cs, Int32(1), Int32(2))).Equals(
|
||||
NewSet(cs)))
|
||||
}
|
||||
|
||||
func TestSetFirst(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
cs := chunks.NewMemoryStore()
|
||||
@@ -382,9 +373,6 @@ func TestSetType(t *testing.T) {
|
||||
s2 := s.Remove(Uint64(1))
|
||||
assert.True(tr.Equals(s2.Type()))
|
||||
|
||||
s2 = s.Subtract(s)
|
||||
assert.True(tr.Equals(s2.Type()))
|
||||
|
||||
s2 = s.Filter(func(v Value) bool {
|
||||
return true
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user