[libgee] Revert "Add additional query functions to Traversable<G>"



commit 14142de75fd91a72126cba91ca80fe6e9b79c0f2
Author: Maciej Piechotka <uzytkownik2 gmail com>
Date:   Sun Feb 11 13:04:11 2018 -0800

    Revert "Add additional query functions to Traversable<G>"
    
    This reverts commit da95e830524ffa309eb57925320666e5085b9d66.

 gee/traversable.vala      |   39 ---------------------------------------
 tests/testcollection.vala |   44 --------------------------------------------
 2 files changed, 0 insertions(+), 83 deletions(-)
---
diff --git a/gee/traversable.vala b/gee/traversable.vala
index 3745f08..9383041 100644
--- a/gee/traversable.vala
+++ b/gee/traversable.vala
@@ -558,45 +558,6 @@ public interface Gee.Traversable<G> : Object {
                return result.iterator ();
        }
 
-       /**
-        * Checks if a signle element matches the given predicate.
-        *
-        * @param pred Predicate to be called to check for matches
-        * @return If a single element matches the predicate
-        * @since 0.20.1
-        */
-       [CCode (ordering = 16)]
-       public virtual bool one_match (owned Predicate<G> pred) {
-               int count = 0;
-               this.foreach ((item) => {
-                       if (pred (item)) {
-                               count++;
-                               return count <= 1;
-                       }
-                       return true;
-               });
-               return count == 1;
-       }
-
-       /**
-        * Counts the number of elements matching the given predicate.
-        *
-        * @param pred Predicate to be called to check for matches
-        * @return The number of elements matching the pre
-        * @since 0.20.1
-        */
-       [CCode (ordering = 17)]
-       public virtual int count_match (owned Predicate<G> pred) {
-               int count = 0;
-               this.foreach ((item) => {
-                       if (pred (item)) {
-                               count++;
-                       }
-                       return true;
-               });
-               return count;
-       }
-
        public enum Stream {
                YIELD,
                CONTINUE,
diff --git a/tests/testcollection.vala b/tests/testcollection.vala
index 0a2b40a..819e130 100644
--- a/tests/testcollection.vala
+++ b/tests/testcollection.vala
@@ -56,8 +56,6 @@ public abstract class CollectionTests : Gee.TestCase {
                add_test ("[Collection] all_match", test_all_match);
                add_test ("[Collection] max_min", test_max_min);
                add_test ("[Collection] order_by", test_order_by);
-               add_test ("[Collection] one_match", test_one_match);
-               add_test ("[Collection] count_match", test_count_match);
        }
 
        protected Collection<string> test_collection;
@@ -1261,47 +1259,5 @@ public abstract class CollectionTests : Gee.TestCase {
                        previous_item = item;
                }
        }
-
-       public void test_one_match () {
-               assert (!test_collection.one_match ((x) => x == "one"));
-
-               assert (test_collection.add ("one"));
-               assert (test_collection.one_match ((x) => x == "one"));
-               assert (!test_collection.one_match ((x) => x == "two"));
-
-               assert (test_collection.add ("two"));
-               assert (test_collection.one_match ((x) => x == "one"));
-               assert (test_collection.one_match ((x) => x == "two"));
-
-               if (test_collection.add ("two")) {
-                       assert (!test_collection.one_match ((x) => x == "two"));
-               } else {
-                       assert (test_collection.one_match ((x) => x == "two"));
-               }
-               assert (test_collection.one_match ((x) => x == "one"));
-
-               assert (!test_collection.one_match ((x) => x == "three"));
-       }
-
-       public void test_count_match () {
-               assert (test_collection.count_match ((x) => x == "one") == 0);
-
-               assert (test_collection.add ("one"));
-               assert (test_collection.count_match ((x) => x == "one") == 1);
-               assert (test_collection.count_match ((x) => x == "two") == 0);
-
-               assert (test_collection.add ("two"));
-               assert (test_collection.count_match ((x) => x == "one") == 1);
-               assert (test_collection.count_match ((x) => x == "two") == 1);
-
-               if (test_collection.add ("two")) {
-                       assert (test_collection.count_match ((x) => x == "two") == 2);
-               } else {
-                       assert (test_collection.count_match ((x) => x == "two") == 1);
-               }
-               assert (test_collection.count_match ((x) => x == "one") == 1);
-
-               assert (test_collection.count_match ((x) => x == "three") == 0);
-       }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]