There is refactoring which sadly not available from menu. But you can
evaluate it manually:

(RBGenerateEqualHashRefactoring className: #YourClass variables: #(var1
var2)) execute


2017-02-20 13:46 GMT+01:00 Trussardi Dario Romano <
dario.trussa...@tiscali.it>:

> Ciao,
>
>         i works with Pharo 4.0 environment.
>
>         I have 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 when add some setup instances of class Product  to a bag,
>
>                  the relative inspector report
>
>                 some aProduct entry but with some Occurences of this set
> to 0.
>
>                 aProduct1       3
>                 aProduct2       0
>                 aProduct3       0
>
>
>         Some consideration about it ?
>
>         Some references about hash implementations ?
>
>         Thanks,
>
>                 Dario
>
>
>

Reply via email to