From 1edbee5f34d015b320dac008323021bd6a1a4d56 Mon Sep 17 00:00:00 2001 From: Erik Arvidsson Date: Thu, 17 Dec 2015 15:23:28 -0500 Subject: [PATCH] Remove Set Subtract --- clients/common/photo.noms.go | 4 ---- clients/crunchbase/importer/sha1_9fb26a6.go | 8 -------- clients/crunchbase/index/index.noms.go | 4 ---- clients/crunchbase/index/sha1_9fb26a6.go | 8 -------- clients/flickr/sha1_42722c5.go | 4 ---- clients/flickr/types.noms.go | 4 ---- clients/picasa/picasa.noms.go | 8 -------- clients/picasa/sha1_42722c5.go | 4 ---- clients/tagdex/sha1_42722c5.go | 4 ---- clients/tagdex/types.noms.go | 4 ---- datas/types.noms.go | 4 ---- nomdl/codegen/set.tmpl | 4 ---- nomdl/codegen/test/gen/ref.noms.go | 4 ---- nomdl/codegen/test/gen/set.noms.go | 4 ---- .../codegen/test/gen/struct_with_union_field.noms.go | 4 ---- types/package_set_of_ref.go | 4 ---- types/set.go | 1 - types/set_leaf.go | 11 ----------- types/set_test.go | 12 ------------ 19 files changed, 100 deletions(-) diff --git a/clients/common/photo.noms.go b/clients/common/photo.noms.go index 7fb39c6a41..4a50ab1c7b 100644 --- a/clients/common/photo.noms.go +++ b/clients/common/photo.noms.go @@ -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() } diff --git a/clients/crunchbase/importer/sha1_9fb26a6.go b/clients/crunchbase/importer/sha1_9fb26a6.go index 96ae98e7d3..62296a0ddb 100644 --- a/clients/crunchbase/importer/sha1_9fb26a6.go +++ b/clients/crunchbase/importer/sha1_9fb26a6.go @@ -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) } diff --git a/clients/crunchbase/index/index.noms.go b/clients/crunchbase/index/index.noms.go index 1c1da91795..9e1cc4baa1 100644 --- a/clients/crunchbase/index/index.noms.go +++ b/clients/crunchbase/index/index.noms.go @@ -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) } diff --git a/clients/crunchbase/index/sha1_9fb26a6.go b/clients/crunchbase/index/sha1_9fb26a6.go index 96ae98e7d3..62296a0ddb 100644 --- a/clients/crunchbase/index/sha1_9fb26a6.go +++ b/clients/crunchbase/index/sha1_9fb26a6.go @@ -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) } diff --git a/clients/flickr/sha1_42722c5.go b/clients/flickr/sha1_42722c5.go index f66288b26c..18d6f940de 100644 --- a/clients/flickr/sha1_42722c5.go +++ b/clients/flickr/sha1_42722c5.go @@ -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() } diff --git a/clients/flickr/types.noms.go b/clients/flickr/types.noms.go index 0cfd6c7df8..d1ed9fe57f 100644 --- a/clients/flickr/types.noms.go +++ b/clients/flickr/types.noms.go @@ -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) } diff --git a/clients/picasa/picasa.noms.go b/clients/picasa/picasa.noms.go index 56ae2b0938..9f3058877d 100644 --- a/clients/picasa/picasa.noms.go +++ b/clients/picasa/picasa.noms.go @@ -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) } diff --git a/clients/picasa/sha1_42722c5.go b/clients/picasa/sha1_42722c5.go index f66288b26c..18d6f940de 100644 --- a/clients/picasa/sha1_42722c5.go +++ b/clients/picasa/sha1_42722c5.go @@ -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() } diff --git a/clients/tagdex/sha1_42722c5.go b/clients/tagdex/sha1_42722c5.go index f66288b26c..18d6f940de 100644 --- a/clients/tagdex/sha1_42722c5.go +++ b/clients/tagdex/sha1_42722c5.go @@ -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() } diff --git a/clients/tagdex/types.noms.go b/clients/tagdex/types.noms.go index a2301298fe..e3b3ab0124 100644 --- a/clients/tagdex/types.noms.go +++ b/clients/tagdex/types.noms.go @@ -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) } diff --git a/datas/types.noms.go b/datas/types.noms.go index eb7541f069..7dd4edce8f 100644 --- a/datas/types.noms.go +++ b/datas/types.noms.go @@ -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) } diff --git a/nomdl/codegen/set.tmpl b/nomdl/codegen/set.tmpl index b7227df4fe..a89c055667 100644 --- a/nomdl/codegen/set.tmpl +++ b/nomdl/codegen/set.tmpl @@ -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}} } diff --git a/nomdl/codegen/test/gen/ref.noms.go b/nomdl/codegen/test/gen/ref.noms.go index ddebefea53..7561121bd3 100644 --- a/nomdl/codegen/test/gen/ref.noms.go +++ b/nomdl/codegen/test/gen/ref.noms.go @@ -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)) } diff --git a/nomdl/codegen/test/gen/set.noms.go b/nomdl/codegen/test/gen/set.noms.go index b33563aa03..7c6687ec72 100644 --- a/nomdl/codegen/test/gen/set.noms.go +++ b/nomdl/codegen/test/gen/set.noms.go @@ -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)) } diff --git a/nomdl/codegen/test/gen/struct_with_union_field.noms.go b/nomdl/codegen/test/gen/struct_with_union_field.noms.go index 3b1f3554e5..22a4e7d8f1 100644 --- a/nomdl/codegen/test/gen/struct_with_union_field.noms.go +++ b/nomdl/codegen/test/gen/struct_with_union_field.noms.go @@ -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)) } diff --git a/types/package_set_of_ref.go b/types/package_set_of_ref.go index 6ec276aaf2..ee50800fcc 100644 --- a/types/package_set_of_ref.go +++ b/types/package_set_of_ref.go @@ -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) } diff --git a/types/set.go b/types/set.go index 5e8e97f492..0c67887444 100644 --- a/types/set.go +++ b/types/set.go @@ -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) diff --git a/types/set_leaf.go b/types/set_leaf.go index dca49851ef..06db2940fc 100644 --- a/types/set_leaf.go +++ b/types/set_leaf.go @@ -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) { diff --git a/types/set_test.go b/types/set_test.go index df6c2225e9..e871f4d0b9 100644 --- a/types/set_test.go +++ b/types/set_test.go @@ -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 })