Heh, I think from the various responses to this original post, it's safe to
say that NOBODY, outside of Einstien or Leibniz, fully comprehends the
best-optimized hashCode algorithm! ;-)
Jonathan, you said that Inprise implements hashing by byte-shifting the
least and most significant digits of the longs, and in effect throwing away
the middle. What if in my particular business arcitecture the middle digits
ARE the most significant? I think this further shows that a vendor cannot
possibly predict what is the "optimimum" solution for the bean architecture!
I commend Inprise for implementing intrinsic hashing for custom pk classes;
however, like you mentioned as a possibility in a previous post, I also look
forward to Inprise implementing hooks that allow us "know-it-all" developers
to give hashing a shot ourselves!
Gene
-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
To: [EMAIL PROTECTED]
Sent: 9/12/00 11:10 PM
Subject: Re: Writing a uniform hashCode method
----- Original Message -----
From: "Cedric Beust" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 12, 2000 18:46
Subject: Re: Writing a uniform hashCode method
> > From: A mailing list for Enterprise JavaBeans development
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Jonathan K. Weedon
>
> > So, in real life a and b will fall into some range. Let's
> > say that a falls into the range [0-A], and b falls into
> > the range [0-B]. Then our hashCode above will fall into
> > a range:
> >
> > [0-(A+B)]
>
> Shouldn't that be [0 - max(A,B)]? (or more precisely, [0 - 1 << (1 +
max of
> their log2]))
I think the correct upper bound is actually
1<<floor(1+max(log2(A),log2(B))) - 1
though you were close :-)
Of course we have
1<<floor(1+max(log2(A),log2(B))) - 1 <= A+B for all A,B>=0
So the range is even less than Jonathan originally gave.
...David
>
> (that doesn't invalidate all your good points)
>
> --
> Cedric
>
>
========================================================================
===
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff EJB-INTEREST". For general help, send email
to
> [EMAIL PROTECTED] and include in the body of the message "help".
========================================================================
===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".