Exemplo n.º 1
0
 /// <summary>
 /// 初始化初值
 /// </summary>
 public override void initDefault()
 {
     this.booleanDic = new IntBooleanMap();
     this.intDic     = new IntIntMap();
     this.longDic    = new IntLongMap();
     this.stringDic  = new SMap <string, string>();
 }
Exemplo n.º 2
0
 /// <summary>
 /// 回池
 /// </summary>
 protected override void toRelease(DataPool pool)
 {
     this.booleanDic = null;
     this.intDic     = null;
     this.longDic    = null;
     this.stringDic  = null;
 }
Exemplo n.º 3
0
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        if (!(data is KeepSaveData))
        {
            return;
        }

        KeepSaveData mData = (KeepSaveData)data;

        this.booleanDic = mData.booleanDic;
        this.intDic     = mData.intDic;
        this.longDic    = mData.longDic;
        this.stringDic  = mData.stringDic;
    }
Exemplo n.º 4
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        stream.startReadObj();

        int booleanDicLen = stream.readLen();

        if (this.booleanDic != null)
        {
            this.booleanDic.clear();
            this.booleanDic.ensureCapacity(booleanDicLen);
        }
        else
        {
            this.booleanDic = new IntBooleanMap(booleanDicLen);
        }

        IntBooleanMap booleanDicT = this.booleanDic;

        for (int booleanDicI = booleanDicLen - 1; booleanDicI >= 0; --booleanDicI)
        {
            int  booleanDicK;
            bool booleanDicV;
            booleanDicK = stream.readInt();

            booleanDicV = stream.readBoolean();

            booleanDicT.put(booleanDicK, booleanDicV);
        }

        int intDicLen = stream.readLen();

        if (this.intDic != null)
        {
            this.intDic.clear();
            this.intDic.ensureCapacity(intDicLen);
        }
        else
        {
            this.intDic = new IntIntMap(intDicLen);
        }

        IntIntMap intDicT = this.intDic;

        for (int intDicI = intDicLen - 1; intDicI >= 0; --intDicI)
        {
            int intDicK;
            int intDicV;
            intDicK = stream.readInt();

            intDicV = stream.readInt();

            intDicT.put(intDicK, intDicV);
        }

        int longDicLen = stream.readLen();

        if (this.longDic != null)
        {
            this.longDic.clear();
            this.longDic.ensureCapacity(longDicLen);
        }
        else
        {
            this.longDic = new IntLongMap(longDicLen);
        }

        IntLongMap longDicT = this.longDic;

        for (int longDicI = longDicLen - 1; longDicI >= 0; --longDicI)
        {
            int  longDicK;
            long longDicV;
            longDicK = stream.readInt();

            longDicV = stream.readLong();

            longDicT.put(longDicK, longDicV);
        }

        int stringDicLen = stream.readLen();

        if (this.stringDic != null)
        {
            this.stringDic.clear();
            this.stringDic.ensureCapacity(stringDicLen);
        }
        else
        {
            this.stringDic = new SMap <string, string>(stringDicLen);
        }

        SMap <string, string> stringDicT = this.stringDic;

        for (int stringDicI = stringDicLen - 1; stringDicI >= 0; --stringDicI)
        {
            string stringDicK;
            string stringDicV;
            stringDicK = stream.readUTF();

            stringDicV = stream.readUTF();

            stringDicT.put(stringDicK, stringDicV);
        }

        stream.endReadObj();
    }
Exemplo n.º 5
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        KeepSaveData mData = (KeepSaveData)data;

        if (mData.booleanDic != null)
        {
            if (this.booleanDic == null)
            {
                return(false);
            }
            if (this.booleanDic.size() != mData.booleanDic.size())
            {
                return(false);
            }
            IntBooleanMap booleanDicR = mData.booleanDic;
            if (!this.booleanDic.isEmpty())
            {
                int    booleanDicKFreeValue = this.booleanDic.getFreeValue();
                int[]  booleanDicKKeys      = this.booleanDic.getKeys();
                bool[] booleanDicVValues    = this.booleanDic.getValues();
                for (int booleanDicKI = booleanDicKKeys.Length - 1; booleanDicKI >= 0; --booleanDicKI)
                {
                    int booleanDicK = booleanDicKKeys[booleanDicKI];
                    if (booleanDicK != booleanDicKFreeValue)
                    {
                        bool booleanDicV = booleanDicVValues[booleanDicKI];
                        bool booleanDicU = booleanDicR.get(booleanDicK);
                        if (booleanDicV != booleanDicU)
                        {
                            return(false);
                        }
                    }
                }
            }
        }
        else
        {
            if (this.booleanDic != null)
            {
                return(false);
            }
        }

        if (mData.intDic != null)
        {
            if (this.intDic == null)
            {
                return(false);
            }
            if (this.intDic.size() != mData.intDic.size())
            {
                return(false);
            }
            IntIntMap intDicR = mData.intDic;
            if (!this.intDic.isEmpty())
            {
                int   intDicKFreeValue = this.intDic.getFreeValue();
                int[] intDicKKeys      = this.intDic.getKeys();
                int[] intDicVValues    = this.intDic.getValues();
                for (int intDicKI = intDicKKeys.Length - 1; intDicKI >= 0; --intDicKI)
                {
                    int intDicK = intDicKKeys[intDicKI];
                    if (intDicK != intDicKFreeValue)
                    {
                        int intDicV = intDicVValues[intDicKI];
                        int intDicU = intDicR.get(intDicK);
                        if (intDicV != intDicU)
                        {
                            return(false);
                        }
                    }
                }
            }
        }
        else
        {
            if (this.intDic != null)
            {
                return(false);
            }
        }

        if (mData.longDic != null)
        {
            if (this.longDic == null)
            {
                return(false);
            }
            if (this.longDic.size() != mData.longDic.size())
            {
                return(false);
            }
            IntLongMap longDicR = mData.longDic;
            if (!this.longDic.isEmpty())
            {
                int    longDicKFreeValue = this.longDic.getFreeValue();
                int[]  longDicKKeys      = this.longDic.getKeys();
                long[] longDicVValues    = this.longDic.getValues();
                for (int longDicKI = longDicKKeys.Length - 1; longDicKI >= 0; --longDicKI)
                {
                    int longDicK = longDicKKeys[longDicKI];
                    if (longDicK != longDicKFreeValue)
                    {
                        long longDicV = longDicVValues[longDicKI];
                        long longDicU = longDicR.get(longDicK);
                        if (longDicV != longDicU)
                        {
                            return(false);
                        }
                    }
                }
            }
        }
        else
        {
            if (this.longDic != null)
            {
                return(false);
            }
        }

        if (mData.stringDic != null)
        {
            if (this.stringDic == null)
            {
                return(false);
            }
            if (this.stringDic.size() != mData.stringDic.size())
            {
                return(false);
            }
            SMap <string, string> stringDicR = mData.stringDic;
            if (!this.stringDic.isEmpty())
            {
                string[] stringDicKKeys   = this.stringDic.getKeys();
                string[] stringDicVValues = this.stringDic.getValues();
                for (int stringDicKI = stringDicKKeys.Length - 1; stringDicKI >= 0; --stringDicKI)
                {
                    string stringDicK = stringDicKKeys[stringDicKI];
                    if (stringDicK != null)
                    {
                        string stringDicV = stringDicVValues[stringDicKI];
                        string stringDicU = stringDicR.get(stringDicK);
                        if (stringDicV != stringDicU)
                        {
                            return(false);
                        }
                    }
                }
            }
        }
        else
        {
            if (this.stringDic != null)
            {
                return(false);
            }
        }

        return(true);
    }
Exemplo n.º 6
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is KeepSaveData))
        {
            return;
        }

        KeepSaveData mData = (KeepSaveData)data;

        if (mData.booleanDic != null)
        {
            if (this.booleanDic != null)
            {
                this.booleanDic.clear();
                this.booleanDic.ensureCapacity(mData.booleanDic.size());
            }
            else
            {
                this.booleanDic = new IntBooleanMap(mData.booleanDic.size());
            }

            IntBooleanMap booleanDicT = this.booleanDic;
            if (!mData.booleanDic.isEmpty())
            {
                int    booleanDicKFreeValue = mData.booleanDic.getFreeValue();
                int[]  booleanDicKKeys      = mData.booleanDic.getKeys();
                bool[] booleanDicVValues    = mData.booleanDic.getValues();
                for (int booleanDicKI = booleanDicKKeys.Length - 1; booleanDicKI >= 0; --booleanDicKI)
                {
                    int booleanDicK = booleanDicKKeys[booleanDicKI];
                    if (booleanDicK != booleanDicKFreeValue)
                    {
                        bool booleanDicV = booleanDicVValues[booleanDicKI];
                        int  booleanDicW;
                        bool booleanDicU;
                        booleanDicW = booleanDicK;

                        booleanDicU = booleanDicV;

                        booleanDicT.put(booleanDicW, booleanDicU);
                    }
                }
            }
        }
        else
        {
            this.booleanDic = null;
            nullObjError("booleanDic");
        }

        if (mData.intDic != null)
        {
            if (this.intDic != null)
            {
                this.intDic.clear();
                this.intDic.ensureCapacity(mData.intDic.size());
            }
            else
            {
                this.intDic = new IntIntMap(mData.intDic.size());
            }

            IntIntMap intDicT = this.intDic;
            if (!mData.intDic.isEmpty())
            {
                int   intDicKFreeValue = mData.intDic.getFreeValue();
                int[] intDicKKeys      = mData.intDic.getKeys();
                int[] intDicVValues    = mData.intDic.getValues();
                for (int intDicKI = intDicKKeys.Length - 1; intDicKI >= 0; --intDicKI)
                {
                    int intDicK = intDicKKeys[intDicKI];
                    if (intDicK != intDicKFreeValue)
                    {
                        int intDicV = intDicVValues[intDicKI];
                        int intDicW;
                        int intDicU;
                        intDicW = intDicK;

                        intDicU = intDicV;

                        intDicT.put(intDicW, intDicU);
                    }
                }
            }
        }
        else
        {
            this.intDic = null;
            nullObjError("intDic");
        }

        if (mData.longDic != null)
        {
            if (this.longDic != null)
            {
                this.longDic.clear();
                this.longDic.ensureCapacity(mData.longDic.size());
            }
            else
            {
                this.longDic = new IntLongMap(mData.longDic.size());
            }

            IntLongMap longDicT = this.longDic;
            if (!mData.longDic.isEmpty())
            {
                int    longDicKFreeValue = mData.longDic.getFreeValue();
                int[]  longDicKKeys      = mData.longDic.getKeys();
                long[] longDicVValues    = mData.longDic.getValues();
                for (int longDicKI = longDicKKeys.Length - 1; longDicKI >= 0; --longDicKI)
                {
                    int longDicK = longDicKKeys[longDicKI];
                    if (longDicK != longDicKFreeValue)
                    {
                        long longDicV = longDicVValues[longDicKI];
                        int  longDicW;
                        long longDicU;
                        longDicW = longDicK;

                        longDicU = longDicV;

                        longDicT.put(longDicW, longDicU);
                    }
                }
            }
        }
        else
        {
            this.longDic = null;
            nullObjError("longDic");
        }

        if (mData.stringDic != null)
        {
            if (this.stringDic != null)
            {
                this.stringDic.clear();
                this.stringDic.ensureCapacity(mData.stringDic.size());
            }
            else
            {
                this.stringDic = new SMap <string, string>(mData.stringDic.size());
            }

            SMap <string, string> stringDicT = this.stringDic;
            if (!mData.stringDic.isEmpty())
            {
                string[] stringDicKKeys   = mData.stringDic.getKeys();
                string[] stringDicVValues = mData.stringDic.getValues();
                for (int stringDicKI = stringDicKKeys.Length - 1; stringDicKI >= 0; --stringDicKI)
                {
                    string stringDicK = stringDicKKeys[stringDicKI];
                    if (stringDicK != null)
                    {
                        string stringDicV = stringDicVValues[stringDicKI];
                        string stringDicW;
                        string stringDicU;
                        stringDicW = stringDicK;

                        stringDicU = stringDicV;

                        stringDicT.put(stringDicW, stringDicU);
                    }
                }
            }
        }
        else
        {
            this.stringDic = null;
            nullObjError("stringDic");
        }
    }