libgee r12 - in trunk: . gee



Author: juergbi
Date: Tue Jan 22 11:01:26 2008
New Revision: 12
URL: http://svn.gnome.org/viewvc/libgee?rev=12&view=rev

Log:
2007-12-15  Juerg Billeter  <j bitron ch>

	* gee/hashmap.vala, gee/hashset.vala: update for vala trunk


Modified:
   trunk/ChangeLog
   trunk/gee/hashmap.vala
   trunk/gee/hashset.vala

Modified: trunk/gee/hashmap.vala
==============================================================================
--- trunk/gee/hashmap.vala	(original)
+++ trunk/gee/hashmap.vala	Tue Jan 22 11:01:26 2008
@@ -74,22 +74,22 @@
 		return new ValueCollection<K,V> (this);
 	}
 
-	private Node<K,V>* lookup_node (K key) {
+	private Node<K,V>** lookup_node (K key) {
 		uint hash_value = _key_hash_func (key);
-		Node<K,V>* node = &_nodes[hash_value % _array_size];
-		while ((*node) != null && (hash_value != (*node).key_hash || !_key_equal_func ((*node).key, key))) {
-			node = &((*node).next);
+		Node<K,V>** node = &_nodes[hash_value % _array_size];
+		while ((*node) != null && (hash_value != ((Node<K,V>) (*node)).key_hash || !_key_equal_func (((Node<K,V>) (*node)).key, key))) {
+			node = &(((Node<K,V>) (*node)).next);
 		}
 		return node;
 	}
 
 	public bool contains (K key) {
-		Node<K,V>* node = lookup_node (key);
+		Node<K,V>** node = lookup_node (key);
 		return (*node != null);
 	}
 
 	public V get (K key) {
-		weak Node<K,V> node = *lookup_node (key);
+		weak Node<K,V> node = (Node<K,V>) (*lookup_node (key));
 		if (node != null) {
 			return node.value;
 		} else {
@@ -98,9 +98,9 @@
 	}
 
 	public void set (K key, V value) {
-		Node<K,V>* node = lookup_node (key);
+		Node<K,V>** node = lookup_node (key);
 		if (*node != null) {
-			(*node).value = value;
+			((Node<K,V>) (*node)).value = value;
 		} else {
 			uint hash_value = _key_hash_func (key);
 			*node = new Node<K,V> (key, value, hash_value);
@@ -111,11 +111,11 @@
 	}
 
 	public bool remove (K key) {
-		Node<K,V>* node = lookup_node (key);
+		Node<K,V>** node = lookup_node (key);
 		if (*node != null) {
-			(*node).key = null;
-			(*node).value = null;
-			*node = (*node).next;
+			((Node<K,V>) (*node)).key = null;
+			((Node<K,V>) (*node)).value = null;
+			*node = ((Node<K,V>) (*node)).next;
 			_nnodes--;
 			resize ();
 			_stamp++;

Modified: trunk/gee/hashset.vala
==============================================================================
--- trunk/gee/hashset.vala	(original)
+++ trunk/gee/hashset.vala	Tue Jan 22 11:01:26 2008
@@ -61,17 +61,17 @@
 		_nodes = new Node<G>[_array_size];
 	}
 
-	private Node<G>* lookup_node (G key) {
+	private Node<G>** lookup_node (G key) {
 		uint hash_value = _hash_func (key);
-		Node<G>* node = &_nodes[hash_value % _array_size];
-		while ((*node) != null && (hash_value != (*node).key_hash || !_equal_func ((*node).key, key))) {
-			node = &((*node).next);
+		Node<G>** node = &_nodes[hash_value % _array_size];
+		while ((*node) != null && (hash_value != ((Node<G>) (*node)).key_hash || !_equal_func (((Node<G>) (*node)).key, key))) {
+			node = &(((Node<G>) (*node)).next);
 		}
 		return node;
 	}
 
 	public bool contains (G key) {
-		Node<G>* node = lookup_node (key);
+		Node<G>** node = lookup_node (key);
 		return (*node != null);
 	}
 
@@ -80,7 +80,7 @@
 	}
 
 	public bool add (G key) {
-		Node<G>* node = lookup_node (key);
+		Node<G>** node = lookup_node (key);
 		if (*node != null) {
 			return false;
 		} else {
@@ -94,10 +94,10 @@
 	}
 
 	public bool remove (G key) {
-		Node<G>* node = lookup_node (key);
+		Node<G>** node = lookup_node (key);
 		if (*node != null) {
-			(*node).key = null;
-			*node = (*node).next;
+			((Node<G>) (*node)).key = null;
+			*node = ((Node<G>) (*node)).next;
 			_nnodes--;
 			resize ();
 			_stamp++;



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