I'm pretty sure that's correct, but is seems unlikely that the sum of the
hashCodes of all the objects in the structure would sum to zero (although it
is possible).  zero seems reasonable for an empty struct (that's what
happened on 6.0), but zero for populated structs seems very unlikely.

barneyb

---
Barney Boisvert, Senior Development Engineer
AudienceCentral
[EMAIL PROTECTED]
voice : 360.756.8080 x12
fax   : 360.647.5351

www.audiencecentral.com


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Matt Liotta
> Sent: Friday, August 22, 2003 1:45 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [CFCDev] cfdump problem
>
>
> I believe that the implementation under-the-covers of a CF struct is
> supposed to implement java.util.Map, which specifies the following for
> hashCode().
>
> Returns the hash code value for this map.  The hash code of a map  is
> defined to be the sum of the hashCodes of each entry in the map's
> entrySet view.  This ensures that t1.equals(t2) implies  that
> t1.hashCode()==t2.hashCode() for any two maps  t1 and t2, as required
> by the general  contract of Object.hashCode.
>
> -Matt
>
> On Friday, August 22, 2003, at 04:40 PM, Barney Boisvert wrote:
>
> > Huh.  That seems like undesirable behaviour, but perhaps it's just me.
> > Anyone with an official perspective care to comment?
> >
> > barneyb
> >
> > ---
> > Barney Boisvert, Senior Development Engineer
> > AudienceCentral
> > [EMAIL PROTECTED]
> > voice : 360.756.8080 x12
> > fax   : 360.647.5351
> >
> > www.audiencecentral.com
> >
> >
> >> -----Original Message-----
> >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> >> Behalf Of Brad Howerter
> >> Sent: Friday, August 22, 2003 1:20 PM
> >> To: '[EMAIL PROTECTED]'
> >> Subject: RE: [CFCDev] cfdump problem
> >>
> >>
> >> Yep, 6.1.  Nope, not empty.  It works for arrays, strings, and
> >> numbers, but
> >> not for structures.
> >>
> >> -----Original Message-----
> >> From: Barney Boisvert [mailto:[EMAIL PROTECTED]
> >> Sent: Friday, August 22, 2003 2:14 PM
> >> To: [EMAIL PROTECTED]
> >> Subject: RE: [CFCDev] cfdump problem
> >>
> >>
> >> Are you running 6.1?  I ran the tests on a box still running 6.0.
> >>  Also, are
> >> they empty?  I noticed that it returned zero when they were
> >> empty, probably
> >> because the hashcode is computed entirely based on the structures
> >> contents,
> >> although I don't know that for sure.
> >>
> >> barneyb
> >>
> >> ---
> >> Barney Boisvert, Senior Development Engineer
> >> AudienceCentral
> >> [EMAIL PROTECTED]
> >> voice : 360.756.8080 x12
> >> fax   : 360.647.5351
> >>
> >> www.audiencecentral.com
> >>
> >>
> >>> -----Original Message-----
> >>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> >>> Behalf Of Brad Howerter
> >>> Sent: Friday, August 22, 2003 12:39 PM
> >>> To: '[EMAIL PROTECTED]'
> >>> Subject: RE: [CFCDev] cfdump problem
> >>>
> >>>
> >>> When I try your code, I get
> >>> 1804807461
> >>> 45751061
> >>> 0
> >>> 0
> >>>
> >>> Why does st.hashCode() return 0?  I've tried some other
> >>> structures as well,
> >>> and hashcode always returns 0 for all of my structures.
> >>>
> >>> -----Original Message-----
> >>> From: Barney Boisvert [mailto:[EMAIL PROTECTED]
> >>> Sent: Thursday, August 21, 2003 4:49 PM
> >>> To: [EMAIL PROTECTED]
> >>> Subject: RE: [CFCDev] cfdump problem
> >>>
> >>>
> >>> hashCode() is a method that every Java object has, and since CF is
> >>> Java,
> >>> every CF object has it as well, including strings, numbers,
> >>> everything.  You
> >>> use it like any other method, except that you needn't have an CF
> >>> object
> >>> (created with createObject() or CFOBJECT) to call it on.
> >>>
> >>> s = "my String";
> >>> writeoutput(s.hashCode() & "<br />");
> >>> d = 0.454;
> >>> writeoutput(d.hashCode() & "<br />");
> >>> st = structNew();
> >>> st['s'] = s;
> >>> writeoutput(st.hashCode() & "<br />");
> >>> st['d'] = d;
> >>> writeoutput(st.hashCode() & "<br />");
> >>>
> >>> the method will return a string that is as unique to the object
> >>> as possible,
> >>> but the same as every other object that is considered 'equal' to
> >>> the object.
> >>> 'equal' is determined by the Java equals() method, which defaults to
> >>> the
> >>> memory location of the class, but is overridden by many classes, most
> >>> notably the String class.  This will output true three times,
> >> even though
> >>> the objects are different.  (That's actually a lie, but it still
> >>> illustrates
> >>> the point).
> >>>
> >>> s = "my String";
> >>> s2 = "my String";
> >>> if (s EQ s2)
> >>>   writeoutput("true<br />");
> >>> if (s.equals(s2))
> >>>   writeoutput("true<br />");
> >>> if (s.hashCode() EQ s2.hashCode())
> >>>   writeoutput("true<br />");
> >>>
> >>> Here's the output I got on my system (for both snippets):
> >>>
> >>> 1804807461
> >>> 45751061
> >>> 6774247
> >>> 7476378
> >>> true
> >>> true
> >>> true
> >>>
> >>> ---
> >>> Barney Boisvert, Senior Development Engineer
> >>> AudienceCentral
> >>> [EMAIL PROTECTED]
> >>> voice : 360.756.8080 x12
> >>> fax   : 360.647.5351
> >>>
> >>> www.audiencecentral.com
> >>>
> >>>
> >>>> -----Original Message-----
> >>>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> >>>> Behalf Of Brad Howerter
> >>>> Sent: Thursday, August 21, 2003 3:28 PM
> >>>> To: '[EMAIL PROTECTED]'
> >>>> Subject: RE: [CFCDev] cfdump problem
> >>>>
> >>>>
> >>>> How do you use hashcode()?  I can't find any documentation for
> >>> it.  Please
> >>>> provide an example.
> >>>>
> >>>> -----Original Message-----
> >>>> From: Chafic Kazoun [mailto:[EMAIL PROTECTED]
> >>>> Sent: Thursday, August 21, 2003 4:13 PM
> >>>> To: [EMAIL PROTECTED]
> >>>> Subject: RE: [CFCDev] cfdump problem
> >>>>
> >>>>
> >>>> The main reason for this is that Flash's debugging tools don't
> >>> always meet
> >>>> your needs and you resort to dumping an object to make
> >>>> sure your code is doing what it needs to do.  The debugger in
> >>>> Flash is also
> >>>> really really slow and dumping out the object rather
> >>>> than dealing with the slow-downs is much easier...
> >>>>
> >>>> Thanks
> >>>>
> >>>> Chafic
> >>>> _____________________________
> >>>> Work: http://www.blinex.com
> >>>> Blog : http://www.rewindlife.com
> >>>>
> >>>> -----Original Message-----
> >>>> From: [EMAIL PROTECTED]
> >>> [mailto:[EMAIL PROTECTED] On Behalf
> >>>> Of Barney Boisvert
> >>>> Sent: Thursday, August 21, 2003 5:58 PM
> >>>> To: [EMAIL PROTECTED]
> >>>> Subject: RE: [CFCDev] cfdump problem
> >>>>
> >>>> What do you use recursive structures in Flash for?
> >> especially with such
> >>>> frequency.
> >>>>
> >>>> ---
> >>>> Barney Boisvert, Senior Development Engineer
> >>>> AudienceCentral
> >>>> [EMAIL PROTECTED]
> >>>> voice : 360.756.8080 x12
> >>>> fax   : 360.647.5351
> >>>>
> >>>> www.audiencecentral.com
> >>>>
> >>>>
> >>>>> -----Original Message-----
> >>>>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> >>>>> Behalf Of Samuel Neff
> >>>>> Sent: Thursday, August 21, 2003 2:09 PM
> >>>>> To: [EMAIL PROTECTED]
> >>>>> Subject: RE: [CFCDev] cfdump problem
> >>>>>
> >>>>>
> >>>>>
> >>>>> There are lots of situations where this recursive structures are
> >>>>> useful.  I
> >>>>> haven't used them in CF, but in Flash we do it all the time.
> >>>>>
> >>>>> Here's a mini cfdump that just does structures and handles
> >>> the recursive
> >>>>> issue.  It uses the hashCode() Barney mentioned.
> >> hashCode() is a Java
> >>>>> function available on any object that creates an (almost) unique
> >>>>> key for the
> >>>>> object.  I say almost 'cause it is theoretically possible
> >> to create a
> >>>>> duplicate, but it's really rare.
> >>>>>
> >>>>> You'd have to expand it to work with arrays and (if you care)
> >>>>> xml, java and
> >>>>> com objects.
> >>>>>
> >>>>> HTH,
> >>>>>
> >>>>> Sam
> >>>>
> >>>> ---
> >>>> Outgoing mail is certified Virus Free.
> >>>> Checked by AVG anti-virus system (http://www.grisoft.com).
> >>>> Version: 6.0.512 / Virus Database: 309 - Release Date: 8/19/2003
> >>>>
> >>>> ----------------------------------------------------------
> >>>> You are subscribed to cfcdev. To unsubscribe, send an email
> >>>> to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> >>>> in the message of the email.
> >>>>
> >>>> CFCDev is run by CFCZone (www.cfczone.org) and supported
> >>>> by Mindtool, Corporation (www.mindtool.com).
> >>>>
> >>>> ----------------------------------------------------------
> >>>> You are subscribed to cfcdev. To unsubscribe, send an email
> >>>> to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> >>>> in the message of the email.
> >>>>
> >>>> CFCDev is run by CFCZone (www.cfczone.org) and supported
> >>>> by Mindtool, Corporation (www.mindtool.com).
> >>>>
> >>>> ----------------------------------------------------------
> >>>> You are subscribed to cfcdev. To unsubscribe, send an email
> >>>> to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> >>>> in the message of the email.
> >>>>
> >>>> CFCDev is run by CFCZone (www.cfczone.org) and supported
> >>>> by Mindtool, Corporation (www.mindtool.com).
> >>>>
> >>> ---
> >>> Outgoing mail is certified Virus Free.
> >>> Checked by AVG anti-virus system (http://www.grisoft.com).
> >>> Version: 6.0.512 / Virus Database: 309 - Release Date: 8/19/2003
> >>>
> >>> ----------------------------------------------------------
> >>> You are subscribed to cfcdev. To unsubscribe, send an email
> >>> to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> >>> in the message of the email.
> >>>
> >>> CFCDev is run by CFCZone (www.cfczone.org) and supported
> >>> by Mindtool, Corporation (www.mindtool.com).
> >>>
> >>> ----------------------------------------------------------
> >>> You are subscribed to cfcdev. To unsubscribe, send an email
> >>> to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> >>> in the message of the email.
> >>>
> >>> CFCDev is run by CFCZone (www.cfczone.org) and supported
> >>> by Mindtool, Corporation (www.mindtool.com).
> >>>
> >> ---
> >> Outgoing mail is certified Virus Free.
> >> Checked by AVG anti-virus system (http://www.grisoft.com).
> >> Version: 6.0.512 / Virus Database: 309 - Release Date: 8/19/2003
> >>
> >> ----------------------------------------------------------
> >> You are subscribed to cfcdev. To unsubscribe, send an email
> >> to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> >> in the message of the email.
> >>
> >> CFCDev is run by CFCZone (www.cfczone.org) and supported
> >> by Mindtool, Corporation (www.mindtool.com).
> >>
> >> ----------------------------------------------------------
> >> You are subscribed to cfcdev. To unsubscribe, send an email
> >> to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> >> in the message of the email.
> >>
> >> CFCDev is run by CFCZone (www.cfczone.org) and supported
> >> by Mindtool, Corporation (www.mindtool.com).
> >>
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.512 / Virus Database: 309 - Release Date: 8/19/2003
> >
> > ----------------------------------------------------------
> > You are subscribed to cfcdev. To unsubscribe, send an email
> > to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> > in the message of the email.
> >
> > CFCDev is run by CFCZone (www.cfczone.org) and supported
> > by Mindtool, Corporation (www.mindtool.com).
> >
> >
> Matt Liotta
> President & CEO
> Montara Software, Inc.
> http://www.MontaraSoftware.com
> (888) 408-0900 x901
>
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> in the message of the email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 8/19/2003

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

Reply via email to