Modify the Map interface API
authorDidier 'Ptitjes <ptitjes@free.fr>
Sun, 20 Sep 2009 14:00:39 +0000 (16:00 +0200)
committerDidier 'Ptitjes <ptitjes@free.fr>
Sun, 20 Sep 2009 15:37:33 +0000 (17:37 +0200)
We do apply the following renaming:
 - remove to unset
 - contains to has_key
 - remove_all to unset_all
 - contains_all to has_all

Old methods are documented as deprecated.

Also get_keys() and get_values() are transformed into properties.

gee/abstractmap.vala
gee/hashmap.vala
gee/hashmultimap.vala
gee/map.vala
gee/readonlymap.vala
gee/treemap.vala
tests/testmap.vala
tests/testtreemap.vala

index 25f702c..a70fcd7 100644 (file)
@@ -47,17 +47,24 @@ public abstract class Gee.AbstractMap<K,V> : Object, Map<K,V> {
        /**
         * @inheritDoc
         */
-       public abstract Set<K> get_keys ();
+       public abstract Set<K> keys { owned get; }
 
        /**
         * @inheritDoc
         */
-       public abstract Collection<V> get_values ();
+       public abstract Collection<V> values { owned get; }
 
        /**
         * @inheritDoc
         */
-       public abstract bool contains (K key);
+       public abstract bool has_key (K key);
+
+       /**
+        * @inheritDoc
+        */
+       public bool contains (K key) {
+               return has_key (key);
+       }
 
        /**
         * @inheritDoc
@@ -72,7 +79,19 @@ public abstract class Gee.AbstractMap<K,V> : Object, Map<K,V> {
        /**
         * @inheritDoc
         */
-       public abstract bool remove (K key, out V? value = null);
+       public abstract bool unset (K key, out V? value = null);
+
+       /**
+        * @inheritDoc
+        */
+       public bool remove (K key, out V? value = null) {
+               V removed_value;
+               bool result = unset (key, out removed_value);
+               if (&value != null) {
+                       value = removed_value;
+               }
+               return result;
+       }
 
        /**
         * @inheritDoc
@@ -83,7 +102,7 @@ public abstract class Gee.AbstractMap<K,V> : Object, Map<K,V> {
         * @inheritDoc
         */
        public virtual void set_all (Map<K,V> map) {
-               foreach (K key in map.get_keys ()) {
+               foreach (K key in map.keys) {
                        set (key, map.get (key));
                }
        }
@@ -91,9 +110,9 @@ public abstract class Gee.AbstractMap<K,V> : Object, Map<K,V> {
        /**
         * @inheritDoc
         */
-       public virtual bool remove_all (Map<K,V> map) {
+       public virtual bool unset_all (Map<K,V> map) {
                bool changed = false;
-               foreach (K key in map.get_keys ()) {
+               foreach (K key in map.keys) {
                        changed = changed | remove (key);
                }
                return changed;
@@ -102,15 +121,29 @@ public abstract class Gee.AbstractMap<K,V> : Object, Map<K,V> {
        /**
         * @inheritDoc
         */
-       public virtual bool contains_all (Map<K,V> map) {
-               foreach (K key in map.get_keys ()) {
-                       if (!contains (key)) {
+       public bool remove_all (Map<K,V> map) {
+               return unset_all (map);
+       }
+
+       /**
+        * @inheritDoc
+        */
+       public virtual bool has_all (Map<K,V> map) {
+               foreach (K key in map.keys) {
+                       if (!has_key (key)) {
                                return false;
                        }
                }
                return true;
        }
 
+       /**
+        * @inheritDoc
+        */
+       public bool contains_all (Map<K,V> map) {
+               return has_all (map);
+       }
+
        private weak Map<K,V> _read_only_view;
 
        /**
index f9211f8..799a4aa 100644 (file)
@@ -42,6 +42,24 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
        }
 
        /**
+        * @inheritDoc
+        */
+       public override Set<K> keys {
+               owned get {
+                       return new KeySet<K,V> (this);
+               }
+       }
+
+       /**
+        * @inheritDoc
+        */
+       public override Collection<V> values {
+               owned get {
+                       return new ValueCollection<K,V> (this);
+               }
+       }
+
+       /**
         * The keys' hash function.
         */
        public HashFunc key_hash_func { private set; get; }
@@ -91,20 +109,6 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
                _nodes = new Node<K,V>[_array_size];
        }
 
-       /**
-        * @inheritDoc
-        */
-       public override Set<K> get_keys () {
-               return new KeySet<K,V> (this);
-       }
-
-       /**
-        * @inheritDoc
-        */
-       public override Collection<V> get_values () {
-               return new ValueCollection<K,V> (this);
-       }
-
        internal Gee.UpdatableKeyIterator<K,V> updatable_key_iterator () {
                return new UpdatableKeyIterator<K,V> (this);
        }
@@ -121,7 +125,7 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
        /**
         * @inheritDoc
         */
-       public override bool contains (K key) {
+       public override bool has_key (K key) {
                Node<K,V>** node = lookup_node (key);
                return (*node != null);
        }
@@ -157,7 +161,7 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
        /**
         * @inheritDoc
         */
-       public override bool remove (K key, out V? value = null) {
+       public override bool unset (K key, out V? value = null) {
                Node<K,V>** node = lookup_node (key);
                if (*node != null) {
                        Node<K,V> next = (owned) (*node)->next;
index 14dbb97..0c46a10 100644 (file)
@@ -62,12 +62,12 @@ public class Gee.HashMultiMap<K,V> : GLib.Object, MultiMap<K,V> {
        }
 
        public Set<K> get_keys () {
-               return _items.get_keys ();
+               return _items.keys;
        }
 
        public MultiSet<K> get_all_keys () {
                MultiSet<K> result = new HashMultiSet<K> (_key_hash_func, _key_equal_func);
-               foreach (var key in _items.get_keys ()) {
+               foreach (var key in _items.keys) {
                        for (int i = 0; i < _items.get (key).size; i++) {
                                result.add (key);
                        }
@@ -77,7 +77,7 @@ public class Gee.HashMultiMap<K,V> : GLib.Object, MultiMap<K,V> {
 
        public Collection<V> get_values () {
                var result = new ArrayList<V> (_value_equal_func);
-               foreach (var key in _items.get_keys ()) {
+               foreach (var key in _items.keys) {
                        foreach (var value in _items.get (key)) {
                                result.add (value);
                        }
index 40d25f3..e28cba1 100644 (file)
@@ -35,18 +35,23 @@ public interface Gee.Map<K,V> : GLib.Object {
        public abstract bool is_empty { get; }
 
        /**
-        * Returns the keys of this map as a read-only set.
-        *
-        * @return the keys of the map
+        * The read-only view of the keys of this map.
+        */
+       public abstract Set<K> keys { owned get; }
+
+       /**
+        * The read-only view of the values of this map.
         */
-       public abstract Set<K> get_keys ();
+       public abstract Collection<V> values { owned get; }
 
        /**
-        * Returns the values of this map as a read-only collection.
+        * Determines whether this map has the specified key.
         *
-        * @return the values of the map
+        * @param key the key to locate in the map
+        *
+        * @return    true if key is found, false otherwise
         */
-       public abstract Collection<V> get_values ();
+       public abstract bool has_key (K key);
 
        /**
         * Determines whether this map contains the specified key.
@@ -54,6 +59,7 @@ public interface Gee.Map<K,V> : GLib.Object {
         * @param key the key to locate in the map
         *
         * @return    true if key is found, false otherwise
+        * @deprecated Use {@link has_key} method instead.
         */
        public abstract bool contains (K key);
 
@@ -83,6 +89,17 @@ public interface Gee.Map<K,V> : GLib.Object {
         *
         * @return    true if the map has been changed, false otherwise
         */
+       public abstract bool unset (K key, out V? value = null);
+
+       /**
+        * Removes the specified key from this map.
+        *
+        * @param key   the key to remove from the map
+        * @param value the receiver variable for the removed value
+        *
+        * @return    true if the map has been changed, false otherwise
+        * @deprecated Use {@link unset} method instead.
+        */
        public abstract bool remove (K key, out V? value = null);
 
        /**
@@ -94,15 +111,24 @@ public interface Gee.Map<K,V> : GLib.Object {
        /**
         * Inserts all items that are contained in the input map to this map.
         *
-        *  @param map the map which items are inserted to this map
+        * @param map the map which items are inserted to this map
         */
        public abstract void set_all (Map<K,V> map);
 
        /**
-        * Removes all items from this map that are common to the input map 
+        * Removes all items from this map that are common to the input map
+        * and this map.
+        *
+        * @param map the map which common items are deleted from this map
+        */
+       public abstract bool unset_all (Map<K,V> map);
+
+       /**
+        * Removes all items from this map that are common to the input map
         * and this map.
         *
-        *  @param map the map which common items are deleted from this map
+        * @param map the map which common items are deleted from this map
+        * @deprecated Use {@link unset_all} method instead.
         */
        public abstract bool remove_all (Map<K,V> map);
 
@@ -111,6 +137,14 @@ public interface Gee.Map<K,V> : GLib.Object {
         *
         * @param map the map which items will be compared with this map.
         */
+       public abstract bool has_all (Map<K,V> map);
+
+       /**
+        * Returns true it this map contains all items as the input map.
+        *
+        * @param map the map which items will be compared with this map.
+        * @deprecated Use {@link has_all} method instead.
+        */
        public abstract bool contains_all (Map<K,V> map);
 
        /**
index 180b941..8bdc4c6 100644 (file)
@@ -47,6 +47,24 @@ internal class Gee.ReadOnlyMap<K,V> : Object, Map<K,V> {
                get { return _map.is_empty; }
        }
 
+       /**
+        * @inheritDoc
+        */
+       public Set<K> keys {
+               owned get {
+                       return _map.keys;
+               }
+       }
+
+       /**
+        * @inheritDoc
+        */
+       public Collection<V> values {
+               owned get {
+                       return _map.values;
+               }
+       }
+
        private Map<K,V> _map;
 
        /**
@@ -61,22 +79,15 @@ internal class Gee.ReadOnlyMap<K,V> : Object, Map<K,V> {
        /**
         * @inheritDoc
         */
-       public Set<K> get_keys () {
-               return _map.get_keys ();
-       }
-
-       /**
-        * @inheritDoc
-        */
-       public Collection<V> get_values () {
-               return _map.get_values ();
+       public bool has_key (K key) {
+               return _map.has_key (key);
        }
 
        /**
         * @inheritDoc
         */
        public bool contains (K key) {
-               return _map.contains (key);
+               return _map.has_key (key);
        }
 
        /**
@@ -96,6 +107,13 @@ internal class Gee.ReadOnlyMap<K,V> : Object, Map<K,V> {
        /**
         * Unimplemented method (read only map).
         */
+       public bool unset (K key, out V? value = null) {
+               assert_not_reached ();
+       }
+
+       /**
+        * Unimplemented method (read only map).
+        */
        public bool remove (K key, out V? value = null) {
                assert_not_reached ();
        }
@@ -117,6 +135,13 @@ internal class Gee.ReadOnlyMap<K,V> : Object, Map<K,V> {
        /**
         * Unimplemented method (read only map).
         */
+       public bool unset_all (Map<K,V> map) {
+               assert_not_reached ();
+       }
+
+       /**
+        * Unimplemented method (read only map).
+        */
        public bool remove_all (Map<K,V> map) {
                assert_not_reached ();
        }
@@ -124,8 +149,15 @@ internal class Gee.ReadOnlyMap<K,V> : Object, Map<K,V> {
        /**
         * @inheritDoc
         */
+       public bool has_all (Map<K,V> map) {
+               return _map.has_all (map);
+       }
+
+       /**
+        * @inheritDoc
+        */
        public bool contains_all (Map<K,V> map) {
-               return _map.contains_all (map);
+               return _map.has_all (map);
        }
 
        public virtual Map<K,V> read_only_view {
index 660e81c..0b402a8 100644 (file)
@@ -40,6 +40,24 @@ public class Gee.TreeMap<K,V> : Gee.AbstractMap<K,V> {
        }
 
        /**
+        * @inheritDoc
+        */
+       public override Set<K> keys {
+               owned get {
+                       return new KeySet<K,V> (this);
+               }
+       }
+
+       /**
+        * @inheritDoc
+        */
+       public override Collection<V> values {
+               owned get {
+                       return new ValueCollection<K,V> (this);
+               }
+       }
+
+       /**
         * The keys' comparator function.
         */
        public CompareFunc key_compare_func { private set; get; }
@@ -69,20 +87,6 @@ public class Gee.TreeMap<K,V> : Gee.AbstractMap<K,V> {
                this.value_equal_func = value_equal_func;
        }
 
-       /**
-        * @inheritDoc
-        */
-       public override Set<K> get_keys () {
-               return new KeySet<K,V> (this);
-       }
-
-       /**
-        * @inheritDoc
-        */
-       public override Collection<V> get_values () {
-               return new ValueCollection<K,V> (this);
-       }
-
        private void rotate_right (ref Node<K, V> root) {
                Node<K,V> pivot = (owned) root.left;
                pivot.color = root.color;
@@ -112,7 +116,7 @@ public class Gee.TreeMap<K,V> : Gee.AbstractMap<K,V> {
        /**
         * @inheritDoc
         */
-       public override bool contains (K key) {
+       public override bool has_key (K key) {
                weak Node<K, V>? cur = root;
                while (cur != null) {
                        int res = key_compare_func (key, cur.key);
@@ -285,7 +289,7 @@ public class Gee.TreeMap<K,V> : Gee.AbstractMap<K,V> {
        /**
         * @inheritDoc
         */
-       public override bool remove (K key, out V? value = null) {
+       public override bool unset (K key, out V? value = null) {
                V node_value;
                bool b = remove_from_node (ref root, key, out node_value);
 
index 739f1a9..b5656df 100644 (file)
@@ -29,137 +29,137 @@ public abstract class MapTests : Gee.TestCase {
 
        public MapTests (string name) {
                base (name);
-               add_test ("[Map] contains, size and is_empty",
-                         test_contains_size_is_empty);
-               add_test ("[Map] get keys", test_get_keys);
-               add_test ("[Map] get values", test_get_values);
+               add_test ("[Map] has_key, size and is_empty",
+                         test_has_key_size_is_empty);
+               add_test ("[Map] keys", test_keys);
+               add_test ("[Map] values", test_values);
                add_test ("[Map] set all", test_set_all);
-               add_test ("[Map] remove all", test_remove_all);
-               add_test ("[Map] contains all", test_contains_all);
+               add_test ("[Map] unset all", test_unset_all);
+               add_test ("[Map] has all", test_has_all);
                add_test ("[Map] GObject properties", test_gobject_properties);
        }
 
        protected Map<string, string> test_map;
 
-       public void test_contains_size_is_empty () {
+       public void test_has_key_size_is_empty () {
                // Check the collection exists
                assert (test_map != null);
                string value;
 
                // Check the collection is initially empty
-               assert (! test_map.contains ("one"));
-               assert (! test_map.contains ("two"));
-               assert (! test_map.contains ("three"));
+               assert (! test_map.has_key ("one"));
+               assert (! test_map.has_key ("two"));
+               assert (! test_map.has_key ("three"));
                assert (test_map.size == 0);
                assert (test_map.is_empty);
 
                // Add a binding
                test_map.set ("one", "value_of_one");
-               assert (test_map.contains ("one"));
+               assert (test_map.has_key ("one"));
                assert (test_map.get ("one") == "value_of_one");
-               assert (! test_map.contains ("two"));
+               assert (! test_map.has_key ("two"));
                assert (test_map.get ("two") == null);
-               assert (! test_map.contains ("three"));
+               assert (! test_map.has_key ("three"));
                assert (test_map.get ("three") == null);
                assert (test_map.size == 1);
                assert (! test_map.is_empty);
 
                // Remove the last added binding
-               assert (test_map.remove ("one"));
-               assert (! test_map.contains ("one"));
+               assert (test_map.unset ("one"));
+               assert (! test_map.has_key ("one"));
                assert (test_map.get ("one") == null);
-               assert (! test_map.contains ("two"));
+               assert (! test_map.has_key ("two"));
                assert (test_map.get ("two") ==  null);
-               assert (! test_map.contains ("three"));
+               assert (! test_map.has_key ("three"));
                assert (test_map.get ("three") == null);
                assert (test_map.size == 0);
                assert (test_map.is_empty);
 
                // Add more bindings
                test_map.set ("one", "value_of_one");
-               assert (test_map.contains ("one"));
+               assert (test_map.has_key ("one"));
                assert (test_map.get ("one") == "value_of_one");
-               assert (! test_map.contains ("two"));
+               assert (! test_map.has_key ("two"));
                assert (test_map.get ("two") == null);
-               assert (! test_map.contains ("three"));
+               assert (! test_map.has_key ("three"));
                assert (test_map.get ("three") == null);
                assert (test_map.size == 1);
                assert (! test_map.is_empty);
 
                test_map.set ("two", "value_of_two");
-               assert (test_map.contains ("one"));
+               assert (test_map.has_key ("one"));
                assert (test_map.get ("one") == "value_of_one");
-               assert (test_map.contains ("two"));
+               assert (test_map.has_key ("two"));
                assert (test_map.get ("two") == "value_of_two");
-               assert (! test_map.contains ("three"));
+               assert (! test_map.has_key ("three"));
                assert (test_map.get ("three") == null);
                assert (test_map.size == 2);
                assert (! test_map.is_empty);
 
                test_map.set ("three", "value_of_three");
-               assert (test_map.contains ("one"));
+               assert (test_map.has_key ("one"));
                assert (test_map.get ("one") == "value_of_one");
-               assert (test_map.contains ("two"));
+               assert (test_map.has_key ("two"));
                assert (test_map.get ("two") == "value_of_two");
-               assert (test_map.contains ("three"));
+               assert (test_map.has_key ("three"));
                assert (test_map.get ("three") == "value_of_three");
                assert (test_map.size == 3);
                assert (! test_map.is_empty);
 
                // Update an existent binding 
                test_map.set ("two", "value_of_two_new");
-               assert (test_map.contains ("one"));
+               assert (test_map.has_key ("one"));
                assert (test_map.get ("one") == "value_of_one");
-               assert (test_map.contains ("two"));
+               assert (test_map.has_key ("two"));
                assert (test_map.get ("two") == "value_of_two_new");
-               assert (test_map.contains ("three"));
+               assert (test_map.has_key ("three"));
                assert (test_map.get ("three") == "value_of_three");
                assert (test_map.size == 3);
                assert (! test_map.is_empty);
 
                // Remove one element
-               assert (test_map.remove ("two", out value));
+               assert (test_map.unset ("two", out value));
                assert (value == "value_of_two_new");
-               assert (test_map.contains("one"));
+               assert (test_map.has_key("one"));
                assert (test_map.get ("one") == "value_of_one");
-               assert (! test_map.contains("two"));
+               assert (! test_map.has_key("two"));
                assert (test_map.get ("two") == null);
-               assert (test_map.contains("three"));
+               assert (test_map.has_key("three"));
                assert (test_map.get ("three") == "value_of_three");
                assert (test_map.size == 2);
                assert (! test_map.is_empty);
 
                // Remove the same element again
-               assert (! test_map.remove ("two", out value));
+               assert (! test_map.unset ("two", out value));
                assert (value == null);
-               assert (test_map.contains("one"));
-               assert (! test_map.contains("two"));
-               assert (test_map.contains("three"));
+               assert (test_map.has_key("one"));
+               assert (! test_map.has_key("two"));
+               assert (test_map.has_key("three"));
                assert (test_map.size == 2);
                assert (! test_map.is_empty);
 
                // Remove all elements
                test_map.clear ();
-               assert (! test_map.contains("one"));
+               assert (! test_map.has_key("one"));
                assert (test_map.get ("one") == null);
-               assert (! test_map.contains("two"));
+               assert (! test_map.has_key("two"));
                assert (test_map.get ("two") == null);
-               assert (! test_map.contains("three"));
+               assert (! test_map.has_key("three"));
                assert (test_map.get ("three") == null);
                assert (test_map.size == 0);
                assert (test_map.is_empty);
        }
 
-       public void test_get_keys () {
+       public void test_keys () {
                // Check keys on empty map
-               var keySet = test_map.get_keys ();
+               var keySet = test_map.keys;
                assert (keySet.size == 0);
 
                // Check keys on map with one item
                test_map.set ("one", "value_of_one");
                assert (keySet.size == 1);
                assert (keySet.contains ("one"));
-               keySet = test_map.get_keys ();
+               keySet = test_map.keys;
                assert (keySet.size == 1);
                assert (keySet.contains ("one"));
 
@@ -177,7 +177,7 @@ public abstract class MapTests : Gee.TestCase {
                assert (keySet.size == 2);
                assert (keySet.contains ("one"));
                assert (keySet.contains ("two"));
-               keySet = test_map.get_keys ();
+               keySet = test_map.keys;
                assert (keySet.size == 2);
                assert (keySet.contains ("one"));
                assert (keySet.contains ("two"));
@@ -185,20 +185,20 @@ public abstract class MapTests : Gee.TestCase {
                // Check keys on map clear
                test_map.clear ();
                assert (keySet.size == 0);
-               keySet = test_map.get_keys ();
+               keySet = test_map.keys;
                assert (keySet.size == 0);
        }
 
-       public void test_get_values () {
+       public void test_values () {
                // Check keys on empty map
-               var valueCollection = test_map.get_values ();
+               var valueCollection = test_map.values;
                assert (valueCollection.size == 0);
 
                // Check keys on map with one item
                test_map.set ("one", "value_of_one");
                assert (valueCollection.size == 1);
                assert (valueCollection.contains ("value_of_one"));
-               valueCollection = test_map.get_values ();
+               valueCollection = test_map.values;
                assert (valueCollection.size == 1);
                assert (valueCollection.contains ("value_of_one"));
 
@@ -216,7 +216,7 @@ public abstract class MapTests : Gee.TestCase {
                assert (valueCollection.size == 2);
                assert (valueCollection.contains ("value_of_one"));
                assert (valueCollection.contains ("value_of_two"));
-               valueCollection = test_map.get_values ();
+               valueCollection = test_map.values;
                assert (valueCollection.size == 2);
                assert (valueCollection.contains ("value_of_one"));
                assert (valueCollection.contains ("value_of_two"));
@@ -224,7 +224,7 @@ public abstract class MapTests : Gee.TestCase {
                // Check keys on map clear
                test_map.clear ();
                assert (valueCollection.size == 0);
-               valueCollection = test_map.get_values ();
+               valueCollection = test_map.values;
                assert (valueCollection.size == 0);
        }
 
@@ -243,12 +243,12 @@ public abstract class MapTests : Gee.TestCase {
                test_map.set_all (another_map);
 
                assert (test_map.size == 6);
-               assert (test_map.contains ("one"));
-               assert (test_map.contains ("two"));
-               assert (test_map.contains ("three"));
-               assert (test_map.contains ("four"));
-               assert (test_map.contains ("five"));
-               assert (test_map.contains ("six"));
+               assert (test_map.has_key ("one"));
+               assert (test_map.has_key ("two"));
+               assert (test_map.has_key ("three"));
+               assert (test_map.has_key ("four"));
+               assert (test_map.has_key ("five"));
+               assert (test_map.has_key ("six"));
 
                assert (test_map.get ("one") == "value_of_one");
                assert (test_map.get ("two") == "value_of_two");
@@ -258,16 +258,16 @@ public abstract class MapTests : Gee.TestCase {
                assert (test_map.get ("six") == "value_of_six");
        }
 
-       public void test_remove_all () {
+       public void test_unset_all () {
                var another_map = new HashMap<string,string> (str_hash,
                                                              str_equal,
                                                              str_equal);
 
-               // Check remove all on empty maps.
+               // Check unset all on empty maps.
                assert (test_map.is_empty);
                assert (another_map.is_empty);
 
-               assert (! test_map.remove_all (another_map));
+               assert (! test_map.unset_all (another_map));
 
                assert (test_map.is_empty);
                assert (another_map.is_empty);
@@ -282,7 +282,7 @@ public abstract class MapTests : Gee.TestCase {
                assert (test_map.is_empty);
                assert (another_map.size == 2);
 
-               assert (! test_map.remove_all (another_map));
+               assert (! test_map.unset_all (another_map));
 
                assert (test_map.is_empty);
                assert (another_map.size == 2);
@@ -297,7 +297,7 @@ public abstract class MapTests : Gee.TestCase {
                assert (test_map.size == 2);
                assert (another_map.is_empty);
 
-               assert (! test_map.remove_all (another_map));
+               assert (! test_map.unset_all (another_map));
 
                assert (test_map.size == 2);
                assert (another_map.is_empty);
@@ -315,7 +315,7 @@ public abstract class MapTests : Gee.TestCase {
                assert (test_map.size == 2);
                assert (another_map.size == 2);
 
-               assert (test_map.remove_all (another_map));
+               assert (test_map.unset_all (another_map));
 
                assert (test_map.is_empty);
                assert (another_map.size == 2);
@@ -337,26 +337,26 @@ public abstract class MapTests : Gee.TestCase {
                assert (test_map.size == 3);
                assert (another_map.size == 4);
 
-               assert (test_map.remove_all (another_map));
+               assert (test_map.unset_all (another_map));
 
                assert (test_map.size == 1);
                assert (another_map.size == 4);
 
-               assert (test_map.contains ("one"));
+               assert (test_map.has_key ("one"));
        }
 
-       public void test_contains_all () {
+       public void test_has_all () {
                var another_map = new HashMap<string,string> (str_hash,
                                                              str_equal,
                                                              str_equal);
 
                // Check empty.
-               assert (test_map.contains_all (another_map));
+               assert (test_map.has_all (another_map));
 
                // Test_Map has items, another_map is empty.
                test_map.set ("one", "value_of_one");
 
-               assert (test_map.contains_all (another_map));
+               assert (test_map.has_all (another_map));
 
                test_map.clear ();
                another_map.clear ();
@@ -364,7 +364,7 @@ public abstract class MapTests : Gee.TestCase {
                // Test_Map is empty, another_map has items.
                another_map.set ("one", "value_of_one");
 
-               assert (! test_map.contains_all (another_map));
+               assert (! test_map.has_all (another_map));
 
                test_map.clear ();
                another_map.clear ();
@@ -376,7 +376,7 @@ public abstract class MapTests : Gee.TestCase {
                another_map.set ("one", "another_value_of_one");
                another_map.set ("two", "another_value_of_two");
 
-               assert (test_map.contains_all (another_map));
+               assert (test_map.has_all (another_map));
 
                test_map.clear ();
                another_map.clear ();
@@ -385,7 +385,7 @@ public abstract class MapTests : Gee.TestCase {
                test_map.set ("one", "value_of_one");
                another_map.set ("two", "value_of_two");
 
-               assert (! test_map.contains_all (another_map));
+               assert (! test_map.has_all (another_map));
 
                test_map.clear ();
                another_map.clear ();
@@ -401,7 +401,7 @@ public abstract class MapTests : Gee.TestCase {
                another_map.set ("three", "value_of_three");
                another_map.set ("four", "value_of_four");
 
-               assert (test_map.contains_all (another_map));
+               assert (test_map.has_all (another_map));
 
                test_map.clear ();
                another_map.clear ();
@@ -418,7 +418,7 @@ public abstract class MapTests : Gee.TestCase {
                another_map.set ("four", "value_of_four");
                another_map.set ("height", "value_of_height");
 
-               assert (! test_map.contains_all (another_map));
+               assert (! test_map.has_all (another_map));
        }
 
        public void test_gobject_properties() {
index 2de2da0..d7b5ca4 100644 (file)
@@ -88,7 +88,7 @@ public class TreeMapTests : MapTests {
                test_tree_map.set ("eleven", "eleven");
                test_tree_map.set ("twelve", "twelve");
 
-               Iterator<string> iterator = test_tree_map.get_keys ().iterator ();
+               Iterator<string> iterator = test_tree_map.keys.iterator ();
                assert (iterator.next () == true);
                assert (iterator.get () == "eight");
                assert (iterator.next () == true);