[libgee] Remove unusefull private setter only and construct only properties



commit bdff9061a4a99b34a5cc7fc58e2a8dfed8e8b862
Author: Didier 'Ptitjes <ptitjes free fr>
Date:   Sat Sep 19 17:40:13 2009 +0200

    Remove unusefull private setter only and construct only properties

 gee/arraylist.vala    |   10 ++--------
 gee/hashmap.vala      |   30 +++++++++++-------------------
 gee/hashmultiset.vala |   11 ++++-------
 gee/hashset.vala      |   10 ++--------
 gee/treemap.vala      |   40 ++++++++++++++--------------------------
 gee/treeset.vala      |   10 ++--------
 6 files changed, 35 insertions(+), 76 deletions(-)
---
diff --git a/gee/arraylist.vala b/gee/arraylist.vala
index 0e0e29e..f3f4ab3 100644
--- a/gee/arraylist.vala
+++ b/gee/arraylist.vala
@@ -247,13 +247,6 @@ public class Gee.ArrayList<G> : AbstractList<G> {
 	}
 
 	private class Iterator<G> : Object, Gee.Iterator<G>, BidirIterator<G>, ListIterator<G> {
-		public ArrayList<G> list {
-			construct {
-				_list = value;
-				_stamp = _list._stamp;
-			}
-		}
-
 		private ArrayList<G> _list;
 		private int _index = -1;
 		private bool _removed = false;
@@ -262,7 +255,8 @@ public class Gee.ArrayList<G> : AbstractList<G> {
 		private int _stamp = 0;
 
 		public Iterator (ArrayList list) {
-			this.list = list;
+			_list = list;
+			_stamp = _list._stamp;
 		}
 
 		public bool next () {
diff --git a/gee/hashmap.vala b/gee/hashmap.vala
index 2e67fed..f9211f8 100644
--- a/gee/hashmap.vala
+++ b/gee/hashmap.vala
@@ -86,9 +86,7 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
 		this.key_hash_func = key_hash_func;
 		this.key_equal_func = key_equal_func;
 		this.value_equal_func = value_equal_func;
-	}
 
-	construct {
 		_array_size = MIN_SIZE;
 		_nodes = new Node<K,V>[_array_size];
 	}
@@ -241,18 +239,18 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
 	}
 
 	private class KeySet<K,V> : AbstractSet<K> {
-		public HashMap<K,V> map { private set; get; }
+		private HashMap<K,V> _map;
 
 		public KeySet (HashMap map) {
-			this.map = map;
+			_map = map;
 		}
 
 		public override Iterator<K> iterator () {
-			return new KeyIterator<K,V> (map);
+			return new KeyIterator<K,V> (_map);
 		}
 
 		public override int size {
-			get { return map.size; }
+			get { return _map.size; }
 		}
 
 		public override bool add (K key) {
@@ -286,18 +284,18 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
 	}
 
 	private class ValueCollection<K,V> : AbstractCollection<V> {
-		public HashMap<K,V> map { private set; get; }
+		private HashMap<K,V> _map;
 
 		public ValueCollection (HashMap map) {
-			this.map = map;
+			_map = map;
 		}
 
 		public override Iterator<V> iterator () {
-			return new ValueIterator<K,V> (map);
+			return new ValueIterator<K,V> (_map);
 		}
 
 		public override int size {
-			get { return map.size; }
+			get { return _map.size; }
 		}
 
 		public override bool add (V value) {
@@ -315,7 +313,7 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
 		public override bool contains (V value) {
 			Iterator<V> it = iterator ();
 			while (it.next ()) {
-				if (map.value_equal_func (it.get (), value)) {
+				if (_map.value_equal_func (it.get (), value)) {
 					return true;
 				}
 			}
@@ -336,13 +334,6 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
 	}
 
 	private abstract class NodeIterator<K,V> : Object {
-		public HashMap<K,V> map {
-			private set {
-				_map = value;
-				_stamp = _map._stamp;
-			}
-		}
-
 		protected HashMap<K,V> _map;
 		private int _index = -1;
 		protected weak Node<K,V> _node;
@@ -352,7 +343,8 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
 		protected int _stamp;
 
 		public NodeIterator (HashMap map) {
-			this.map = map;
+			_map = map;
+			_stamp = _map._stamp;
 		}
 
 		public bool next () {
diff --git a/gee/hashmultiset.vala b/gee/hashmultiset.vala
index ed7d2eb..37f0a3c 100644
--- a/gee/hashmultiset.vala
+++ b/gee/hashmultiset.vala
@@ -93,18 +93,15 @@ public class Gee.HashMultiSet<G> : AbstractCollection<G>, MultiSet<G> {
 	}
 
 	private class Iterator<G> : Object, Gee.Iterator<G> {
-		public new HashMultiSet<G> set { construct; get; }
+		private HashMultiSet<G> _set;
 
 		private Gee.UpdatableKeyIterator<G, int> _iter;
 		private int _pending = 0;
 		private bool _removed = false;
 
-		construct {
-			_iter = set._items.updatable_key_iterator ();
-		}
-
 		public Iterator (HashMultiSet<G> set) {
-			this.set = set;
+			_set = set;
+			_iter = _set._items.updatable_key_iterator ();
 		}
 
 		public bool next () {
@@ -126,7 +123,7 @@ public class Gee.HashMultiSet<G> : AbstractCollection<G>, MultiSet<G> {
 		}
 
 		public bool first () {
-			if (set._nitems == 0) {
+			if (_set._nitems == 0) {
 				return false;
 			}
 			_pending = 0;
diff --git a/gee/hashset.vala b/gee/hashset.vala
index e1a3fbc..f3922c4 100644
--- a/gee/hashset.vala
+++ b/gee/hashset.vala
@@ -199,13 +199,6 @@ public class Gee.HashSet<G> : AbstractSet<G> {
 	}
 
 	private class Iterator<G> : Object, Gee.Iterator<G> {
-		public new HashSet<G> set {
-			construct {
-				_set = value;
-				_stamp = _set._stamp;
-			}
-		}
-
 		private HashSet<G> _set;
 		private int _index = -1;
 		private weak Node<G> _node;
@@ -215,7 +208,8 @@ public class Gee.HashSet<G> : AbstractSet<G> {
 		private int _stamp = 0;
 
 		public Iterator (HashSet set) {
-			this.set = set;
+			_set = set;
+			_stamp = _set._stamp;
 		}
 
 		public bool next () {
diff --git a/gee/treemap.vala b/gee/treemap.vala
index a9d7fef..054bf65 100644
--- a/gee/treemap.vala
+++ b/gee/treemap.vala
@@ -363,18 +363,18 @@ public class Gee.TreeMap<K,V> : Gee.AbstractMap<K,V> {
 	private int stamp = 0;
 
 	private class KeySet<K,V> : AbstractSet<K> {
-		public TreeMap<K,V> map { private set; get; }
+		private TreeMap<K,V> _map;
 
 		public KeySet (TreeMap<K,V> map) {
-			this.map = map;
+			_map = map;
 		}
 
 		public override Iterator<K> iterator () {
-			return new KeyIterator<K,V> (map);
+			return new KeyIterator<K,V> (_map);
 		}
 
 		public override int size {
-			get { return map.size; }
+			get { return _map.size; }
 		}
 
 		public override bool add (K key) {
@@ -390,7 +390,7 @@ public class Gee.TreeMap<K,V> : Gee.AbstractMap<K,V> {
 		}
 
 		public override bool contains (K key) {
-			return map.contains (key);
+			return _map.contains (key);
 		}
 
 		public override bool add_all (Collection<K> collection) {
@@ -407,18 +407,18 @@ public class Gee.TreeMap<K,V> : Gee.AbstractMap<K,V> {
 	}
 
 	private class ValueCollection<K,V> : AbstractCollection<V> {
-		public TreeMap<K,V> map { private set; get; }
+		private TreeMap<K,V> _map;
 
 		public ValueCollection (TreeMap<K,V> map) {
-			this.map = map;
+			_map = map;
 		}
 
 		public override Iterator<V> iterator () {
-			return new ValueIterator<K,V> (map);
+			return new ValueIterator<K,V> (_map);
 		}
 
 		public override int size {
-			get { return map.size; }
+			get { return _map.size; }
 		}
 
 		public override bool add (V key) {
@@ -436,7 +436,7 @@ public class Gee.TreeMap<K,V> : Gee.AbstractMap<K,V> {
 		public override bool contains (V key) {
 			Iterator<V> it = iterator ();
 			while (it.next ()) {
-				if (map.value_equal_func (key, it.get ())) {
+				if (_map.value_equal_func (key, it.get ())) {
 					return true;
 				}
 			}
@@ -457,20 +457,14 @@ public class Gee.TreeMap<K,V> : Gee.AbstractMap<K,V> {
 	}
 
 	private class KeyIterator<K,V> : Object, Gee.Iterator<K>, BidirIterator<K> {
-		public TreeMap<K,V> map {
-			private set {
-				_map = value;
-				stamp = _map.stamp;
-			}
-		}
-
 		private TreeMap<K,V> _map;
 
 		// concurrent modification protection
 		private int stamp;
 
 		public KeyIterator (TreeMap<K,V> map) {
-			this.map = map;
+			_map = map;
+			stamp = _map.stamp;
 		}
 
 		public bool next () {
@@ -539,20 +533,14 @@ public class Gee.TreeMap<K,V> : Gee.AbstractMap<K,V> {
 	}
 
 	private class ValueIterator<K,V> : Object, Gee.Iterator<V>, Gee.BidirIterator<V> {
-		public TreeMap<K,V> map {
-			private set {
-				_map = value;
-				stamp = _map.stamp;
-			}
-		}
-
 		private TreeMap<K,V> _map;
 
 		// concurrent modification protection
 		private int stamp;
 
 		public ValueIterator (TreeMap<K,V> map) {
-			this.map = map;
+			_map = map;
+			stamp = _map.stamp;
 		}
 
 		public bool next () {
diff --git a/gee/treeset.vala b/gee/treeset.vala
index 7593f53..bddef09 100644
--- a/gee/treeset.vala
+++ b/gee/treeset.vala
@@ -328,20 +328,14 @@ public class Gee.TreeSet<G> : AbstractSet<G> {
 	}
 
 	private class Iterator<G> : Object, Gee.Iterator<G>, BidirIterator<G> {
-		public new TreeSet<G> set {
-			private set {
-				_set = value;
-				stamp = _set.stamp;
-			}
-		}
-
 		private TreeSet<G> _set;
 
 		// concurrent modification protection
 		private int stamp;
 
 		public Iterator (TreeSet<G> set) {
-			this.set = set;
+			_set = set;
+			stamp = _set.stamp;
 		}
 
 		public bool next () {



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