From bdff9061a4a99b34a5cc7fc58e2a8dfed8e8b862 Mon Sep 17 00:00:00 2001 From: Didier 'Ptitjes Date: Sat, 19 Sep 2009 17:40:13 +0200 Subject: [PATCH] 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 : AbstractList { } private class Iterator : Object, Gee.Iterator, BidirIterator, ListIterator { - public ArrayList list { - construct { - _list = value; - _stamp = _list._stamp; - } - } - private ArrayList _list; private int _index = -1; private bool _removed = false; @@ -262,7 +255,8 @@ public class Gee.ArrayList : AbstractList { 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 : Gee.AbstractMap { 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[_array_size]; } @@ -241,18 +239,18 @@ public class Gee.HashMap : Gee.AbstractMap { } private class KeySet : AbstractSet { - public HashMap map { private set; get; } + private HashMap _map; public KeySet (HashMap map) { - this.map = map; + _map = map; } public override Iterator iterator () { - return new KeyIterator (map); + return new KeyIterator (_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 : Gee.AbstractMap { } private class ValueCollection : AbstractCollection { - public HashMap map { private set; get; } + private HashMap _map; public ValueCollection (HashMap map) { - this.map = map; + _map = map; } public override Iterator iterator () { - return new ValueIterator (map); + return new ValueIterator (_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 : Gee.AbstractMap { public override bool contains (V value) { Iterator 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 : Gee.AbstractMap { } private abstract class NodeIterator : Object { - public HashMap map { - private set { - _map = value; - _stamp = _map._stamp; - } - } - protected HashMap _map; private int _index = -1; protected weak Node _node; @@ -352,7 +343,8 @@ public class Gee.HashMap : Gee.AbstractMap { 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 : AbstractCollection, MultiSet { } private class Iterator : Object, Gee.Iterator { - public new HashMultiSet set { construct; get; } + private HashMultiSet _set; private Gee.UpdatableKeyIterator _iter; private int _pending = 0; private bool _removed = false; - construct { - _iter = set._items.updatable_key_iterator (); - } - public Iterator (HashMultiSet set) { - this.set = set; + _set = set; + _iter = _set._items.updatable_key_iterator (); } public bool next () { @@ -126,7 +123,7 @@ public class Gee.HashMultiSet : AbstractCollection, MultiSet { } 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 : AbstractSet { } private class Iterator : Object, Gee.Iterator { - public new HashSet set { - construct { - _set = value; - _stamp = _set._stamp; - } - } - private HashSet _set; private int _index = -1; private weak Node _node; @@ -215,7 +208,8 @@ public class Gee.HashSet : AbstractSet { 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 : Gee.AbstractMap { private int stamp = 0; private class KeySet : AbstractSet { - public TreeMap map { private set; get; } + private TreeMap _map; public KeySet (TreeMap map) { - this.map = map; + _map = map; } public override Iterator iterator () { - return new KeyIterator (map); + return new KeyIterator (_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 : Gee.AbstractMap { } public override bool contains (K key) { - return map.contains (key); + return _map.contains (key); } public override bool add_all (Collection collection) { @@ -407,18 +407,18 @@ public class Gee.TreeMap : Gee.AbstractMap { } private class ValueCollection : AbstractCollection { - public TreeMap map { private set; get; } + private TreeMap _map; public ValueCollection (TreeMap map) { - this.map = map; + _map = map; } public override Iterator iterator () { - return new ValueIterator (map); + return new ValueIterator (_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 : Gee.AbstractMap { public override bool contains (V key) { Iterator 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 : Gee.AbstractMap { } private class KeyIterator : Object, Gee.Iterator, BidirIterator { - public TreeMap map { - private set { - _map = value; - stamp = _map.stamp; - } - } - private TreeMap _map; // concurrent modification protection private int stamp; public KeyIterator (TreeMap map) { - this.map = map; + _map = map; + stamp = _map.stamp; } public bool next () { @@ -539,20 +533,14 @@ public class Gee.TreeMap : Gee.AbstractMap { } private class ValueIterator : Object, Gee.Iterator, Gee.BidirIterator { - public TreeMap map { - private set { - _map = value; - stamp = _map.stamp; - } - } - private TreeMap _map; // concurrent modification protection private int stamp; public ValueIterator (TreeMap 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 : AbstractSet { } private class Iterator : Object, Gee.Iterator, BidirIterator { - public new TreeSet set { - private set { - _set = value; - stamp = _set.stamp; - } - } - private TreeSet _set; // concurrent modification protection private int stamp; public Iterator (TreeSet set) { - this.set = set; + _set = set; + stamp = _set.stamp; } public bool next () { -- 2.7.4