From 544c201ae11ee32a2b1b7342c38dcdd075c024f4 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Thu, 12 Feb 2009 04:00:20 +0000 Subject: [PATCH] change --- Robust/src/ClassLibrary/DistributedHashMap.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Robust/src/ClassLibrary/DistributedHashMap.java b/Robust/src/ClassLibrary/DistributedHashMap.java index b3aac7b3..c6444a04 100644 --- a/Robust/src/ClassLibrary/DistributedHashMap.java +++ b/Robust/src/ClassLibrary/DistributedHashMap.java @@ -122,13 +122,6 @@ public class DistributedHashMap { dhe=global new DistributedHashEntry(secondcapacity); table[index1]=dhe; } - - dhe.count++; - if (dhe.count>(loadFactor*dhe.array.length)) { - //Resize the table - resize(index1); - } - int index2=hash2(hashcode, table.length, dhe.array.length); DHashEntry ptr=dhe.array[index2]; @@ -136,17 +129,23 @@ public class DistributedHashMap { if (ptr.hashval!=hashcode&&ptr.key.equals(key)) { Object oldvalue=ptr.value; ptr.value=value; - dhe.count--; return oldvalue; } ptr=ptr.next; } + DHashEntry he=global new DHashEntry(); he.value=value; he.key=key; he.hashval=hashcode; he.next=dhe.array[index2]; dhe.array[index2]=he; + + dhe.count++; + if (dhe.count>(loadFactor*dhe.array.length)) { + //Resize the table + resize(index1); + } return null; } } -- 2.34.1