Exemplo n.º 1
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        FriendPartData mData = (FriendPartData)data;

        if (mData.friends != null)
        {
            if (this.friends == null)
            {
                return(false);
            }
            if (this.friends.size() != mData.friends.size())
            {
                return(false);
            }
            LongObjectMap <FriendData> friendsR = mData.friends;
            if (!this.friends.isEmpty())
            {
                long         friendsKFreeValue = this.friends.getFreeValue();
                long[]       friendsKKeys      = this.friends.getKeys();
                FriendData[] friendsVValues    = this.friends.getValues();
                for (int friendsKI = friendsKKeys.Length - 1; friendsKI >= 0; --friendsKI)
                {
                    long friendsK = friendsKKeys[friendsKI];
                    if (friendsK != friendsKFreeValue)
                    {
                        FriendData friendsV = friendsVValues[friendsKI];
                        FriendData friendsU = friendsR.get(friendsK);
                        if (friendsU != null)
                        {
                            if (friendsV == null)
                            {
                                return(false);
                            }
                            if (!friendsV.dataEquals(friendsU))
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            if (friendsV != null)
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
        }
        else
        {
            if (this.friends != null)
            {
                return(false);
            }
        }

        if (mData.blackList != null)
        {
            if (this.blackList == null)
            {
                return(false);
            }
            if (this.blackList.size() != mData.blackList.size())
            {
                return(false);
            }
            LongObjectMap <ContactData> blackListR = mData.blackList;
            if (!this.blackList.isEmpty())
            {
                long          blackListKFreeValue = this.blackList.getFreeValue();
                long[]        blackListKKeys      = this.blackList.getKeys();
                ContactData[] blackListVValues    = this.blackList.getValues();
                for (int blackListKI = blackListKKeys.Length - 1; blackListKI >= 0; --blackListKI)
                {
                    long blackListK = blackListKKeys[blackListKI];
                    if (blackListK != blackListKFreeValue)
                    {
                        ContactData blackListV = blackListVValues[blackListKI];
                        ContactData blackListU = blackListR.get(blackListK);
                        if (blackListU != null)
                        {
                            if (blackListV == null)
                            {
                                return(false);
                            }
                            if (!blackListV.dataEquals(blackListU))
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            if (blackListV != null)
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
        }
        else
        {
            if (this.blackList != null)
            {
                return(false);
            }
        }

        if (mData.applyDic != null)
        {
            if (this.applyDic == null)
            {
                return(false);
            }
            if (this.applyDic.size() != mData.applyDic.size())
            {
                return(false);
            }
            LongObjectMap <ApplyAddFriendData> applyDicR = mData.applyDic;
            if (!this.applyDic.isEmpty())
            {
                long   applyDicKFreeValue            = this.applyDic.getFreeValue();
                long[] applyDicKKeys                 = this.applyDic.getKeys();
                ApplyAddFriendData[] applyDicVValues = this.applyDic.getValues();
                for (int applyDicKI = applyDicKKeys.Length - 1; applyDicKI >= 0; --applyDicKI)
                {
                    long applyDicK = applyDicKKeys[applyDicKI];
                    if (applyDicK != applyDicKFreeValue)
                    {
                        ApplyAddFriendData applyDicV = applyDicVValues[applyDicKI];
                        ApplyAddFriendData applyDicU = applyDicR.get(applyDicK);
                        if (applyDicU != null)
                        {
                            if (applyDicV == null)
                            {
                                return(false);
                            }
                            if (!applyDicV.dataEquals(applyDicU))
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            if (applyDicV != null)
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
        }
        else
        {
            if (this.applyDic != null)
            {
                return(false);
            }
        }

        return(true);
    }