1. #1
    Sencha User
    Join Date
    Sep 2011
    Location
    Leipzig, Germany
    Posts
    75
    Vote Rating
    1
    A.Rothe is on a distinguished road

      0  

    Question Hashcode() and equals()

    Hashcode() and equals()


    Hi,

    I have overwritten hashCode() and equals() for subclasses of BaseTreeModel and BaseModelData. It seems, that a lot of methods within TreeGrid and TreeStore go wrong. Both classes hold some type of cache or wrapper lists, which can not find changed models. I have changed some properties of a model and the hashcode has been re-calculated. So I don't get the parent of a model nor I can update a changed model within the store.

    Is it not possible to reimplement both methods when using GXT? The implementation follows this example:

    Code:
        public int hashCode() {
            return get("property") == null ? 0 : get("property").hashCode();
        }
    
        public boolean equals(Object other) {
            if (this == other) {
                return true;
            }
            if (!(other instanceof Thing)) {
                return false;
            }
            Thing t = (Thing) other;
            return ((get("property") == null) ? t.get("property") == null : get("property").equals(t.get("property")));
        }

    Thanks
    Andre

  2. #2
    Sencha User
    Join Date
    Sep 2011
    Location
    Leipzig, Germany
    Posts
    75
    Vote Rating
    1
    A.Rothe is on a distinguished road

      0  

    Default


    It seems, that the following is a good workaround:

    1. find the model within the store
    2. save the index of the model
    3. remove the model
    4. change the model's properties
    5. re-insert the model on index

    or

    don't override hashCode() nor equals .

    ~Andre

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi