commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael A. Smith" <...@apache.org>
Subject RE: [collections] Avalon excalibur collections migration status
Date Wed, 10 Jul 2002 13:35:47 GMT
On Wed, 10 Jul 2002, Berin Loritsch wrote:
> > MIGRATION FROM AVALON EXCALIBUR'S COLLECTIONS
> > 
> > CircularBuffer has not yet been migrated.
> 
> 
> CircularBuffer is deprecated in favor of the Buffer classes.
> It offers no additional functionality beyond the variable
> sized buffer (in fact the variable size buffer was an adaptation
> and cleanup of CircularBuffer).

ah, ok.  

> > BinaryHeap, PriorityQueue, and BucketMap have changed in 
> > Avalon since they were copied to commons.  There have been 
> > changes in the commons version as well, so merging may not be 
> > easy (it isn't helped by the fact that avalon's code was restylized).
> 
> I would venture to say that BinaryHeap and PriorityQueue are farther
> along in Commons.  The only changes to BucketMap were the hashing
> algorithm.  Anything else was trying to keep up with the discussions
> on commons.  Use the commons version, and possibly use the new hashing
> algorithm (protects against poor hashes).

speaking of the hashing algorithm, it looks like you implemented it, but 
there were no comments added on where it came from: 

-        final int hash = key.hashCode() % m_buckets.length;
+        int hash = key.hashCode();
+        
+        hash += ~(hash << 9);
+        hash ^=  (hash >>> 14);
+        hash +=  (hash << 4);
+        hash ^=  (hash >>> 10);
+        
+        hash %= m_buckets.length;
+

Was this based on some reference you found somewhere on implementing a 
hashing algorithm that isn't dependent on number of buckets, or was it 
chosen based on emperical evidence?  When I started working on the 
DynamicBucketMap, I looked into better hashing algorithms in my trusty 
algorithms book, and didn't see anything quite like what you used.  

> > CHANGES FOR EXCALIBUR USERS TO BECOME COMMONS USERS FOR COLLECTIONS
> > 
> > There may be additional changes depending on the completion of the 
> > migration (e.g. CircularBuffer users may need to change their class 
> > names or something).  
> 
> 
> CircularBuffer has been deprecated for quite a few months now.  I
> doubt there are any current users.

ah, I see that now.  6 months ago, just prior to the excalibur 4.1 
release.  

regards,
michael


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message