summaryrefslogtreecommitdiff
path: root/gee
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2008-08-14 21:22:53 +0000
committerJürg Billeter <juergbi@src.gnome.org>2008-08-14 21:22:53 +0000
commit8621de12c043a7a7d959dbca9b70a5fa02c34781 (patch)
tree2f656d4d065c78104a0af9e4d93ece1b8ccb7463 /gee
parent2166f7c312de0cd0e0f474cfff44c3293fea3098 (diff)
downloadvala-8621de12c043a7a7d959dbca9b70a5fa02c34781.tar.gz
Don't derive from GObject in libvala where not necessary to improve
2008-08-14 Jürg Billeter <j@bitron.ch> Don't derive from GObject in libvala where not necessary to improve compilation performance svn path=/trunk/; revision=1757
Diffstat (limited to 'gee')
-rw-r--r--gee/Makefile.am1
-rw-r--r--gee/arraylist.vala4
-rw-r--r--gee/collectionobject.vala30
-rw-r--r--gee/hashmap.vala13
-rw-r--r--gee/hashset.vala7
-rw-r--r--gee/iterable.vala2
-rw-r--r--gee/iterator.vala2
-rw-r--r--gee/map.vala2
-rw-r--r--gee/readonlycollection.vala4
-rw-r--r--gee/readonlylist.vala4
-rw-r--r--gee/readonlymap.vala2
-rw-r--r--gee/readonlyset.vala4
12 files changed, 50 insertions, 25 deletions
diff --git a/gee/Makefile.am b/gee/Makefile.am
index 8f5f1bec0..63a8654d3 100644
--- a/gee/Makefile.am
+++ b/gee/Makefile.am
@@ -14,6 +14,7 @@ noinst_LTLIBRARIES = \
libgee_la_VALASOURCES = \
arraylist.vala \
collection.vala \
+ collectionobject.vala \
hashmap.vala \
hashset.vala \
iterable.vala \
diff --git a/gee/arraylist.vala b/gee/arraylist.vala
index 97ce9292d..183119b26 100644
--- a/gee/arraylist.vala
+++ b/gee/arraylist.vala
@@ -27,7 +27,7 @@ using GLib;
/**
* Arrays of arbitrary elements which grow automatically as elements are added.
*/
-public class Gee.ArrayList<G> : Object, Iterable<G>, Collection<G>, List<G> {
+public class Gee.ArrayList<G> : CollectionObject, Iterable<G>, Collection<G>, List<G> {
public int size {
get { return _size; }
}
@@ -152,7 +152,7 @@ public class Gee.ArrayList<G> : Object, Iterable<G>, Collection<G>, List<G> {
_items.resize (value);
}
- private class Iterator<G> : Object, Gee.Iterator<G> {
+ private class Iterator<G> : CollectionObject, Gee.Iterator<G> {
public ArrayList<G> list {
set {
_list = value;
diff --git a/gee/collectionobject.vala b/gee/collectionobject.vala
new file mode 100644
index 000000000..08398e266
--- /dev/null
+++ b/gee/collectionobject.vala
@@ -0,0 +1,30 @@
+/* collectionobject.vala
+ *
+ * Copyright (C) 2008 Jürg Billeter
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Jürg Billeter <j@bitron.ch>
+ */
+
+using GLib;
+
+/**
+ * Base class for all collections.
+ */
+public class Gee.CollectionObject {
+}
+
diff --git a/gee/hashmap.vala b/gee/hashmap.vala
index 3802468b6..7c4765263 100644
--- a/gee/hashmap.vala
+++ b/gee/hashmap.vala
@@ -27,7 +27,7 @@ using GLib;
/**
* Hashtable implementation of the Map interface.
*/
-public class Gee.HashMap<K,V> : Object, Map<K,V> {
+public class Gee.HashMap<K,V> : CollectionObject, Map<K,V> {
public int size {
get { return _nnodes; }
}
@@ -62,9 +62,6 @@ public class Gee.HashMap<K,V> : Object, Map<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];
}
@@ -182,7 +179,7 @@ public class Gee.HashMap<K,V> : Object, Map<K,V> {
}
}
- private class KeySet<K,V> : Object, Iterable<K>, Collection<K>, Set<K> {
+ private class KeySet<K,V> : CollectionObject, Iterable<K>, Collection<K>, Set<K> {
public HashMap<K,V> map {
set { _map = value; }
}
@@ -222,7 +219,7 @@ public class Gee.HashMap<K,V> : Object, Map<K,V> {
}
}
- private class KeyIterator<K,V> : Object, Iterator<K> {
+ private class KeyIterator<K,V> : CollectionObject, Iterator<K> {
public HashMap<K,V> map {
set {
_map = value;
@@ -259,7 +256,7 @@ public class Gee.HashMap<K,V> : Object, Map<K,V> {
}
}
- private class ValueCollection<K,V> : Object, Iterable<V>, Collection<V> {
+ private class ValueCollection<K,V> : CollectionObject, Iterable<V>, Collection<V> {
public HashMap<K,V> map {
set { _map = value; }
}
@@ -305,7 +302,7 @@ public class Gee.HashMap<K,V> : Object, Map<K,V> {
}
}
- private class ValueIterator<K,V> : Object, Iterator<V> {
+ private class ValueIterator<K,V> : CollectionObject, Iterator<V> {
public HashMap<K,V> map {
set {
_map = value;
diff --git a/gee/hashset.vala b/gee/hashset.vala
index d614701bf..af9c781fe 100644
--- a/gee/hashset.vala
+++ b/gee/hashset.vala
@@ -27,7 +27,7 @@ using GLib;
/**
* Hashtable implementation of the Set interface.
*/
-public class Gee.HashSet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
+public class Gee.HashSet<G> : CollectionObject, Iterable<G>, Collection<G>, Set<G> {
public int size {
get { return _nnodes; }
}
@@ -56,9 +56,6 @@ public class Gee.HashSet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
public HashSet (HashFunc hash_func = GLib.direct_hash, EqualFunc equal_func = GLib.direct_equal) {
this.hash_func = hash_func;
this.equal_func = equal_func;
- }
-
- construct {
_array_size = MIN_SIZE;
_nodes = new Node<G>[_array_size];
}
@@ -164,7 +161,7 @@ public class Gee.HashSet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
}
}
- private class Iterator<G> : Object, Gee.Iterator<G> {
+ private class Iterator<G> : CollectionObject, Gee.Iterator<G> {
public HashSet<G> set {
set {
_set = value;
diff --git a/gee/iterable.vala b/gee/iterable.vala
index ca13109c2..998f59860 100644
--- a/gee/iterable.vala
+++ b/gee/iterable.vala
@@ -26,7 +26,7 @@ using GLib;
* Implemented by classes that support a simple iteration over instances of the
* collection.
*/
-public interface Gee.Iterable<G> : GLib.Object {
+public interface Gee.Iterable<G> : CollectionObject {
public abstract Type get_element_type ();
/**
diff --git a/gee/iterator.vala b/gee/iterator.vala
index 6642a9072..fddee817d 100644
--- a/gee/iterator.vala
+++ b/gee/iterator.vala
@@ -24,7 +24,7 @@
* Implemented by classes that support a simple iteration over instances of the
* collection.
*/
-public interface Gee.Iterator<G> : GLib.Object {
+public interface Gee.Iterator<G> : CollectionObject {
/**
* Advances to the next element in the iteration.
*
diff --git a/gee/map.vala b/gee/map.vala
index 78858ce40..e56a7b5b6 100644
--- a/gee/map.vala
+++ b/gee/map.vala
@@ -23,7 +23,7 @@
/**
* A map is a generic collection of key/value pairs.
*/
-public interface Gee.Map<K,V> : GLib.Object {
+public interface Gee.Map<K,V> : CollectionObject {
/**
* The number of items in this map.
*/
diff --git a/gee/readonlycollection.vala b/gee/readonlycollection.vala
index 3a4ac77dd..c1c7165cd 100644
--- a/gee/readonlycollection.vala
+++ b/gee/readonlycollection.vala
@@ -25,7 +25,7 @@ using GLib;
/**
* Represents a read-only collection of items.
*/
-public class Gee.ReadOnlyCollection<G> : Object, Iterable<G>, Collection<G> {
+public class Gee.ReadOnlyCollection<G> : CollectionObject, Iterable<G>, Collection<G> {
public int size {
get { return _collection.size; }
}
@@ -72,7 +72,7 @@ public class Gee.ReadOnlyCollection<G> : Object, Iterable<G>, Collection<G> {
assert_not_reached ();
}
- private class Iterator<G> : Object, Gee.Iterator<G> {
+ private class Iterator<G> : CollectionObject, Gee.Iterator<G> {
public bool next () {
return false;
}
diff --git a/gee/readonlylist.vala b/gee/readonlylist.vala
index 1ea988d8e..d03eb4d7e 100644
--- a/gee/readonlylist.vala
+++ b/gee/readonlylist.vala
@@ -25,7 +25,7 @@ using GLib;
/**
* Represents a read-only collection of items in a well-defined order.
*/
-public class Gee.ReadOnlyList<G> : Object, Iterable<G>, Collection<G>, List<G> {
+public class Gee.ReadOnlyList<G> : CollectionObject, Iterable<G>, Collection<G>, List<G> {
public int size {
get { return _list.size; }
}
@@ -100,7 +100,7 @@ public class Gee.ReadOnlyList<G> : Object, Iterable<G>, Collection<G>, List<G> {
assert_not_reached ();
}
- class Iterator<G> : Object, Gee.Iterator<G> {
+ class Iterator<G> : CollectionObject, Gee.Iterator<G> {
public bool next () {
return false;
}
diff --git a/gee/readonlymap.vala b/gee/readonlymap.vala
index e62952703..c8e352cfb 100644
--- a/gee/readonlymap.vala
+++ b/gee/readonlymap.vala
@@ -25,7 +25,7 @@ using GLib;
/**
* Represents a read-only collection of key/value pairs.
*/
-public class Gee.ReadOnlyMap<K,V> : Object, Map<K,V> {
+public class Gee.ReadOnlyMap<K,V> : CollectionObject, Map<K,V> {
public int size {
get { return _map.size; }
}
diff --git a/gee/readonlyset.vala b/gee/readonlyset.vala
index 15bcd52de..54600dcc8 100644
--- a/gee/readonlyset.vala
+++ b/gee/readonlyset.vala
@@ -25,7 +25,7 @@ using GLib;
/**
* Represents a read-only collection of items without duplicates.
*/
-public class Gee.ReadOnlySet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
+public class Gee.ReadOnlySet<G> : CollectionObject, Iterable<G>, Collection<G>, Set<G> {
public int size {
get { return _set.size; }
}
@@ -72,7 +72,7 @@ public class Gee.ReadOnlySet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
assert_not_reached ();
}
- private class Iterator<G> : Object, Gee.Iterator<G> {
+ private class Iterator<G> : CollectionObject, Gee.Iterator<G> {
public bool next () {
return false;
}