[libgee] Change inner classes' properties from construct to private set



commit ff7c9f3212eb0d8ea65bb77aab9bff36752774b6
Author: Didier 'Ptitjes <ptitjes free fr>
Date:   Thu Sep 3 20:57:00 2009 +0200

    Change inner classes' properties from construct to private set
    
    Removing construct properties enables the use of Vala's constructor chain up.

 gee/hashmap.vala |    8 ++++----
 gee/treemap.vala |   40 +++++++++++++++++++++++++++++-----------
 2 files changed, 33 insertions(+), 15 deletions(-)
---
diff --git a/gee/hashmap.vala b/gee/hashmap.vala
index 93bed36..071a607 100644
--- a/gee/hashmap.vala
+++ b/gee/hashmap.vala
@@ -191,7 +191,7 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
 	}
 
 	private class KeySet<K,V> : AbstractCollection<K>, Set<K> {
-		public HashMap<K,V> map { construct; get; }
+		public HashMap<K,V> map { private set; get; }
 
 		public KeySet (HashMap map) {
 			this.map = map;
@@ -236,7 +236,7 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
 
 	private class KeyIterator<K,V> : Object, Iterator<K> {
 		public HashMap<K,V> map {
-			construct {
+			private set {
 				_map = value;
 				_stamp = _map._stamp;
 			}
@@ -272,7 +272,7 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
 	}
 
 	private class ValueCollection<K,V> : AbstractCollection<K> {
-		public HashMap<K,V> map { construct; get; }
+		public HashMap<K,V> map { private set; get; }
 
 		public ValueCollection (HashMap map) {
 			this.map = map;
@@ -323,7 +323,7 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
 
 	private class ValueIterator<K,V> : Object, Iterator<V> {
 		public HashMap<K,V> map {
-			construct {
+			private set {
 				_map = value;
 				_stamp = _map._stamp;
 			}
diff --git a/gee/treemap.vala b/gee/treemap.vala
index daf9027..db943cf 100644
--- a/gee/treemap.vala
+++ b/gee/treemap.vala
@@ -310,7 +310,7 @@ public class Gee.TreeMap<K,V> : Gee.AbstractMap<K,V> {
 	private int stamp = 0;
 
 	private class KeySet<K,V> : AbstractCollection<K>, Set<K> {
-		public TreeMap<K,V> map { construct; get; }
+		public TreeMap<K,V> map { private set; get; }
 
 		public KeySet (TreeMap<K,V> map) {
 			this.map = map;
@@ -354,9 +354,9 @@ public class Gee.TreeMap<K,V> : Gee.AbstractMap<K,V> {
 	}
 
 	private class ValueCollection<K,V> : AbstractCollection<V> {
-		public TreeMap<K,V> map { construct; get; }
+		public TreeMap<K,V> map { private set; get; }
 
-		public ValueCollection (TreeMap map) {
+		public ValueCollection (TreeMap<K,V> map) {
 			this.map = map;
 		}
 
@@ -404,12 +404,21 @@ public class Gee.TreeMap<K,V> : Gee.AbstractMap<K,V> {
 	}
 
 	private class KeyIterator<K,V> : Object, Gee.Iterator<K> {
-		public TreeMap<K,V> map { construct; get; }
-		private int stamp;
-		construct {
-			stamp = map.stamp;
+		public TreeMap<K,V> map {
+			private set {
+				_map = value;
+				stamp = _map.stamp;
+			}
+			get {
+				return _map;
+			}
 		}
 
+		private TreeMap<K,V> _map;
+
+		// concurrent modification protection
+		private int stamp;
+
 		public KeyIterator (TreeMap<K,V> map) {
 			this.map = map;
 		}
@@ -438,12 +447,21 @@ public class Gee.TreeMap<K,V> : Gee.AbstractMap<K,V> {
 	}
 
 	private class ValueIterator<K,V> : Object, Gee.Iterator<V> {
-		public TreeMap<K,V> map { construct; get; }
-		private int stamp;
-		construct {
-			stamp = map.stamp;
+		public TreeMap<K,V> map {
+			private set {
+				_map = value;
+				stamp = _map.stamp;
+			}
+			get {
+				return _map;
+			}
 		}
 
+		private TreeMap<K,V> _map;
+
+		// concurrent modification protection
+		private int stamp;
+
 		public ValueIterator (TreeMap<K,V> map) {
 			this.map = map;
 		}



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