Esempio n. 1
0
    /// <summary>
    /// 写入字节流(简版)
    /// </summary>
    protected override void toWriteBytesSimple(BytesWriteStream stream)
    {
        base.toWriteBytesSimple(stream);

        if (this.itemRecords != null)
        {
            stream.writeLen(this.itemRecords.size());
            if (!this.itemRecords.isEmpty())
            {
                AuctionItemRecordData[] itemRecordsVValues = this.itemRecords.getValues();
                for (int itemRecordsVI = itemRecordsVValues.Length - 1; itemRecordsVI >= 0; --itemRecordsVI)
                {
                    AuctionItemRecordData itemRecordsV = itemRecordsVValues[itemRecordsVI];
                    if (itemRecordsV != null)
                    {
                        if (itemRecordsV != null)
                        {
                            stream.writeDataSimpleNotNull(itemRecordsV);
                        }
                        else
                        {
                            nullObjError("itemRecordsV");
                        }
                    }
                }
            }
        }
        else
        {
            nullObjError("itemRecords");
        }
    }
Esempio n. 2
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is AuctionItemRecordData))
        {
            return;
        }

        AuctionItemRecordData mData = (AuctionItemRecordData)data;

        this.id = mData.id;

        this.price = mData.price;

        if (mData.days != null)
        {
            if (this.days != null)
            {
                this.days.clear();
                this.days.ensureCapacity(mData.days.size());
            }
            else
            {
                this.days = new SQueue <CountData>();
            }

            SQueue <CountData> daysT = this.days;
            if (!mData.days.isEmpty())
            {
                CountData[] daysVValues = mData.days.getValues();
                int         daysVMark   = mData.days.getMark();
                int         daysVStart  = mData.days.getStart();
                for (int daysVI = 0, daysVLen = mData.days.length(); daysVI < daysVLen; ++daysVI)
                {
                    CountData daysV = daysVValues[(daysVI + daysVStart) & daysVMark];
                    CountData daysU;
                    if (daysV != null)
                    {
                        daysU = (CountData)daysV.clone();
                    }
                    else
                    {
                        daysU = null;
                        nullObjError("daysU");
                    }

                    daysT.offer(daysU);
                }
            }
        }
        else
        {
            this.days = null;
            nullObjError("days");
        }
    }
Esempio n. 3
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        base.toCopy(data);

        if (!(data is AuctionToolData))
        {
            return;
        }

        AuctionToolData mData = (AuctionToolData)data;

        if (mData.itemRecords != null)
        {
            if (this.itemRecords != null)
            {
                this.itemRecords.clear();
                this.itemRecords.ensureCapacity(mData.itemRecords.size());
            }
            else
            {
                this.itemRecords = new IntObjectMap <AuctionItemRecordData>(mData.itemRecords.size());
            }

            IntObjectMap <AuctionItemRecordData> itemRecordsT = this.itemRecords;
            if (!mData.itemRecords.isEmpty())
            {
                AuctionItemRecordData[] itemRecordsVValues = mData.itemRecords.getValues();
                for (int itemRecordsVI = itemRecordsVValues.Length - 1; itemRecordsVI >= 0; --itemRecordsVI)
                {
                    AuctionItemRecordData itemRecordsV = itemRecordsVValues[itemRecordsVI];
                    if (itemRecordsV != null)
                    {
                        AuctionItemRecordData itemRecordsU;
                        if (itemRecordsV != null)
                        {
                            itemRecordsU = (AuctionItemRecordData)itemRecordsV.clone();
                        }
                        else
                        {
                            itemRecordsU = null;
                            nullObjError("itemRecordsU");
                        }

                        itemRecordsT.put(itemRecordsU.id, itemRecordsU);
                    }
                }
            }
        }
        else
        {
            this.itemRecords = null;
            nullObjError("itemRecords");
        }
    }
Esempio n. 4
0
    /// <summary>
    /// 转文本输出
    /// </summary>
    protected override void toWriteDataString(DataWriter writer)
    {
        base.toWriteDataString(writer);

        writer.writeTabs();
        writer.sb.Append("itemRecords");
        writer.sb.Append(':');
        writer.sb.Append("Map<int,AuctionItemRecordData>");
        if (this.itemRecords != null)
        {
            writer.sb.Append('(');
            writer.sb.Append(this.itemRecords.size());
            writer.sb.Append(')');
            writer.writeEnter();
            writer.writeLeftBrace();
            if (!this.itemRecords.isEmpty())
            {
                int   itemRecordsKFreeValue = this.itemRecords.getFreeValue();
                int[] itemRecordsKKeys      = this.itemRecords.getKeys();
                AuctionItemRecordData[] itemRecordsVValues = this.itemRecords.getValues();
                for (int itemRecordsKI = itemRecordsKKeys.Length - 1; itemRecordsKI >= 0; --itemRecordsKI)
                {
                    int itemRecordsK = itemRecordsKKeys[itemRecordsKI];
                    if (itemRecordsK != itemRecordsKFreeValue)
                    {
                        AuctionItemRecordData itemRecordsV = itemRecordsVValues[itemRecordsKI];
                        writer.writeTabs();
                        writer.sb.Append(itemRecordsK);

                        writer.sb.Append(':');
                        if (itemRecordsV != null)
                        {
                            itemRecordsV.writeDataString(writer);
                        }
                        else
                        {
                            writer.sb.Append("AuctionItemRecordData=null");
                        }

                        writer.writeEnter();
                    }
                }
            }
            writer.writeRightBrace();
        }
        else
        {
            writer.sb.Append("=null");
        }

        writer.writeEnter();
    }
Esempio n. 5
0
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        if (!(data is AuctionItemRecordData))
        {
            return;
        }

        AuctionItemRecordData mData = (AuctionItemRecordData)data;

        this.id    = mData.id;
        this.price = mData.price;
        this.days  = mData.days;
    }
Esempio n. 6
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        base.toReadBytesFull(stream);

        stream.startReadObj();

        int itemRecordsLen = stream.readLen();

        if (this.itemRecords != null)
        {
            this.itemRecords.clear();
            this.itemRecords.ensureCapacity(itemRecordsLen);
        }
        else
        {
            this.itemRecords = new IntObjectMap <AuctionItemRecordData>(itemRecordsLen);
        }

        IntObjectMap <AuctionItemRecordData> itemRecordsT = this.itemRecords;

        for (int itemRecordsI = itemRecordsLen - 1; itemRecordsI >= 0; --itemRecordsI)
        {
            AuctionItemRecordData itemRecordsV;
            BaseData itemRecordsVT = stream.readDataFullNotNull();
            if (itemRecordsVT != null)
            {
                if (itemRecordsVT is AuctionItemRecordData)
                {
                    itemRecordsV = (AuctionItemRecordData)itemRecordsVT;
                }
                else
                {
                    itemRecordsV = new AuctionItemRecordData();
                    if (!(itemRecordsVT.GetType().IsAssignableFrom(typeof(AuctionItemRecordData))))
                    {
                        stream.throwTypeReadError(typeof(AuctionItemRecordData), itemRecordsVT.GetType());
                    }
                    itemRecordsV.shadowCopy(itemRecordsVT);
                }
            }
            else
            {
                itemRecordsV = null;
            }

            itemRecordsT.put(itemRecordsV.id, itemRecordsV);
        }

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

        if (this.id != mData.id)
        {
            return(false);
        }

        if (this.price != mData.price)
        {
            return(false);
        }

        if (mData.days != null)
        {
            if (this.days == null)
            {
                return(false);
            }
            if (this.days.size() != mData.days.size())
            {
                return(false);
            }
            SQueue <CountData> daysT = this.days;
            SQueue <CountData> daysR = mData.days;
            int daysLen = daysT.size();
            for (int daysI = 0; daysI < daysLen; ++daysI)
            {
                CountData daysU = daysT.get(daysI);
                CountData daysV = daysR.get(daysI);
                if (daysV != null)
                {
                    if (daysU == null)
                    {
                        return(false);
                    }
                    if (!daysU.dataEquals(daysV))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (daysU != null)
                    {
                        return(false);
                    }
                }
            }
        }
        else
        {
            if (this.days != null)
            {
                return(false);
            }
        }

        return(true);
    }
Esempio n. 8
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        if (!base.toDataEquals(data))
        {
            return(false);
        }

        AuctionToolData mData = (AuctionToolData)data;

        if (mData.itemRecords != null)
        {
            if (this.itemRecords == null)
            {
                return(false);
            }
            if (this.itemRecords.size() != mData.itemRecords.size())
            {
                return(false);
            }
            IntObjectMap <AuctionItemRecordData> itemRecordsR = mData.itemRecords;
            if (!this.itemRecords.isEmpty())
            {
                int   itemRecordsKFreeValue = this.itemRecords.getFreeValue();
                int[] itemRecordsKKeys      = this.itemRecords.getKeys();
                AuctionItemRecordData[] itemRecordsVValues = this.itemRecords.getValues();
                for (int itemRecordsKI = itemRecordsKKeys.Length - 1; itemRecordsKI >= 0; --itemRecordsKI)
                {
                    int itemRecordsK = itemRecordsKKeys[itemRecordsKI];
                    if (itemRecordsK != itemRecordsKFreeValue)
                    {
                        AuctionItemRecordData itemRecordsV = itemRecordsVValues[itemRecordsKI];
                        AuctionItemRecordData itemRecordsU = itemRecordsR.get(itemRecordsK);
                        if (itemRecordsU != null)
                        {
                            if (itemRecordsV == null)
                            {
                                return(false);
                            }
                            if (!itemRecordsV.dataEquals(itemRecordsU))
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            if (itemRecordsV != null)
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
        }
        else
        {
            if (this.itemRecords != null)
            {
                return(false);
            }
        }

        return(true);
    }