Ciao,

        i have a class with some instance variable.

        For example  a class Product  with some instance variable and the       
 =      method set to:

        = anItem

        anItem ifNil:[^false]. 
        
        anItem class = self class ifFalse:[ ^false].
        
        ^  rfrConsegna  = anItem rfrConsegna 
                                and:[ rfrSubTable  = anItem rfrSubTable
                                        and:[ rfrDcm = anItem rfrDcm
                                                and:[ indexRiga = anItem 
indexRiga
                                                        and:[ referenceTime = 
anItem referenceTime 
                                                                and:[ consumer 
= anItem consumer
                                                                        and:[ 
item = anItem item
                                                                                
and:[ opzioniVoce  = anItem opzioniVoce
                                                                ]]]]]]]
        
        Some of these variables are instances  of classes with specific 
implementation and some variables themselves.


        I set the relative hash method to:

        hash
        
        ^ rfrConsegna hash
                bitXor:( rfrSubTable  hash
                        bitXor: ( rfrDcm hash
                                bitXor: ( indexRiga hash
                                        bitXor: ( referenceTime hash
                                                bitXor: ( consumer   hash
                                                        bitXor: ( item   hash
                                                                bitXor: ( 
opzioniVoce  hash
                                                
                                )))))))
        

        Now my doubt,  having many variables affecting the hash calculation,

        is to be sure  that different instances don't give the same hash value.

        Some advice about it?


        Thanks,

                Dario

        

Reply via email to