Beispiel #1
0
        /// <summary>
        /// Compares for reference AND value equality.
        /// </summary>
        /// <param name="obj">The object to compare with this instance.</param>
        /// <returns>
        ///     <c>true</c> if both operands are equal; otherwise, <c>false</c>.
        /// </returns>
        public bool Equals(AggregateID obj)
        {
            bool ivarsEqual = true;

            if (obj.GetType() != this.GetType())
            {
                return(false);
            }

            if (this._site != obj._site)
            {
                ivarsEqual = false;
            }

            if (this._application != obj._application)
            {
                ivarsEqual = false;
            }

            if (this._aggregateID != obj._aggregateID)
            {
                ivarsEqual = false;
            }

            return(ivarsEqual);
        }
        public override int GetMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize  = base.GetMarshalledSize();
            marshalSize += this._aggregateID.GetMarshalledSize();      // this._aggregateID
            marshalSize += 1;                                          // this._forceID
            marshalSize += 1;                                          // this._aggregateState
            marshalSize += this._aggregateType.GetMarshalledSize();    // this._aggregateType
            marshalSize += 4;                                          // this._formation
            marshalSize += this._aggregateMarking.GetMarshalledSize(); // this._aggregateMarking
            marshalSize += this._dimensions.GetMarshalledSize();       // this._dimensions
            marshalSize += this._orientation.GetMarshalledSize();      // this._orientation
            marshalSize += this._centerOfMass.GetMarshalledSize();     // this._centerOfMass
            marshalSize += this._velocity.GetMarshalledSize();         // this._velocity
            marshalSize += 2;                                          // this._numberOfDisAggregates
            marshalSize += 2;                                          // this._numberOfDisEntities
            marshalSize += 2;                                          // this._numberOfSilentAggregateTypes
            marshalSize += 2;                                          // this._numberOfSilentEntityTypes
            for (int idx = 0; idx < this._aggregateIDList.Count; idx++)
            {
                AggregateID listElement = (AggregateID)this._aggregateIDList[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

            for (int idx = 0; idx < this._entityIDList.Count; idx++)
            {
                EntityID listElement = (EntityID)this._entityIDList[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

            marshalSize += 1;  // this._pad2
            for (int idx = 0; idx < this._silentAggregateSystemList.Count; idx++)
            {
                EntityType listElement = (EntityType)this._silentAggregateSystemList[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

            for (int idx = 0; idx < this._silentEntitySystemList.Count; idx++)
            {
                EntityType listElement = (EntityType)this._silentEntitySystemList[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

            marshalSize += 4;  // this._numberOfVariableDatumRecords
            for (int idx = 0; idx < this._variableDatumList.Count; idx++)
            {
                VariableDatum listElement = (VariableDatum)this._variableDatumList[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

            return(marshalSize);
        }
        /// <summary>
        /// Compares for reference AND value equality.
        /// </summary>
        /// <param name="obj">The object to compare with this instance.</param>
        /// <returns>
        /// 	<c>true</c> if both operands are equal; otherwise, <c>false</c>.
        /// </returns>
        public bool Equals(AggregateID obj)
        {
            bool ivarsEqual = true;

            if (obj.GetType() != this.GetType())
            {
                return false;
            }

            if (this._site != obj._site)
            {
                ivarsEqual = false;
            }

            if (this._application != obj._application)
            {
                ivarsEqual = false;
            }

            if (this._aggregateID != obj._aggregateID)
            {
                ivarsEqual = false;
            }

            return ivarsEqual;
        }
        public override void Reflection(StringBuilder sb)
        {
            sb.AppendLine("<AggregateStatePdu>");
            base.Reflection(sb);
            try
            {
                sb.AppendLine("<aggregateID>");
                this._aggregateID.Reflection(sb);
                sb.AppendLine("</aggregateID>");
                sb.AppendLine("<forceID type=\"byte\">" + this._forceID.ToString(CultureInfo.InvariantCulture) + "</forceID>");
                sb.AppendLine("<aggregateState type=\"byte\">" + this._aggregateState.ToString(CultureInfo.InvariantCulture) + "</aggregateState>");
                sb.AppendLine("<aggregateType>");
                this._aggregateType.Reflection(sb);
                sb.AppendLine("</aggregateType>");
                sb.AppendLine("<formation type=\"uint\">" + this._formation.ToString(CultureInfo.InvariantCulture) + "</formation>");
                sb.AppendLine("<aggregateMarking>");
                this._aggregateMarking.Reflection(sb);
                sb.AppendLine("</aggregateMarking>");
                sb.AppendLine("<dimensions>");
                this._dimensions.Reflection(sb);
                sb.AppendLine("</dimensions>");
                sb.AppendLine("<orientation>");
                this._orientation.Reflection(sb);
                sb.AppendLine("</orientation>");
                sb.AppendLine("<centerOfMass>");
                this._centerOfMass.Reflection(sb);
                sb.AppendLine("</centerOfMass>");
                sb.AppendLine("<velocity>");
                this._velocity.Reflection(sb);
                sb.AppendLine("</velocity>");
                sb.AppendLine("<aggregateIDList type=\"ushort\">" + this._aggregateIDList.Count.ToString(CultureInfo.InvariantCulture) + "</aggregateIDList>");
                sb.AppendLine("<entityIDList type=\"ushort\">" + this._entityIDList.Count.ToString(CultureInfo.InvariantCulture) + "</entityIDList>");
                sb.AppendLine("<silentAggregateSystemList type=\"ushort\">" + this._silentAggregateSystemList.Count.ToString(CultureInfo.InvariantCulture) + "</silentAggregateSystemList>");
                sb.AppendLine("<silentEntitySystemList type=\"ushort\">" + this._silentEntitySystemList.Count.ToString(CultureInfo.InvariantCulture) + "</silentEntitySystemList>");
                for (int idx = 0; idx < this._aggregateIDList.Count; idx++)
                {
                    sb.AppendLine("<aggregateIDList" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"AggregateID\">");
                    AggregateID aAggregateID = (AggregateID)this._aggregateIDList[idx];
                    aAggregateID.Reflection(sb);
                    sb.AppendLine("</aggregateIDList" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

                for (int idx = 0; idx < this._entityIDList.Count; idx++)
                {
                    sb.AppendLine("<entityIDList" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"EntityID\">");
                    EntityID aEntityID = (EntityID)this._entityIDList[idx];
                    aEntityID.Reflection(sb);
                    sb.AppendLine("</entityIDList" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

                sb.AppendLine("<pad2 type=\"byte\">" + this._pad2.ToString(CultureInfo.InvariantCulture) + "</pad2>");
                for (int idx = 0; idx < this._silentAggregateSystemList.Count; idx++)
                {
                    sb.AppendLine("<silentAggregateSystemList" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"EntityType\">");
                    EntityType aEntityType = (EntityType)this._silentAggregateSystemList[idx];
                    aEntityType.Reflection(sb);
                    sb.AppendLine("</silentAggregateSystemList" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

                for (int idx = 0; idx < this._silentEntitySystemList.Count; idx++)
                {
                    sb.AppendLine("<silentEntitySystemList" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"EntityType\">");
                    EntityType aEntityType = (EntityType)this._silentEntitySystemList[idx];
                    aEntityType.Reflection(sb);
                    sb.AppendLine("</silentEntitySystemList" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

                sb.AppendLine("<variableDatumList type=\"uint\">" + this._variableDatumList.Count.ToString(CultureInfo.InvariantCulture) + "</variableDatumList>");
                for (int idx = 0; idx < this._variableDatumList.Count; idx++)
                {
                    sb.AppendLine("<variableDatumList" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"VariableDatum\">");
                    VariableDatum aVariableDatum = (VariableDatum)this._variableDatumList[idx];
                    aVariableDatum.Reflection(sb);
                    sb.AppendLine("</variableDatumList" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

                sb.AppendLine("</AggregateStatePdu>");
            }
            catch (Exception e)
            {
#if DEBUG
                Trace.WriteLine(e);
                Trace.Flush();
#endif
                this.OnException(e);
            }
        }
        public override void Unmarshal(DataInputStream dis)
        {
            base.Unmarshal(dis);

            if (dis != null)
            {
                try
                {
                    this._aggregateID.Unmarshal(dis);
                    this._forceID        = dis.ReadUnsignedByte();
                    this._aggregateState = dis.ReadUnsignedByte();
                    this._aggregateType.Unmarshal(dis);
                    this._formation = dis.ReadUnsignedInt();
                    this._aggregateMarking.Unmarshal(dis);
                    this._dimensions.Unmarshal(dis);
                    this._orientation.Unmarshal(dis);
                    this._centerOfMass.Unmarshal(dis);
                    this._velocity.Unmarshal(dis);
                    this._numberOfDisAggregates        = dis.ReadUnsignedShort();
                    this._numberOfDisEntities          = dis.ReadUnsignedShort();
                    this._numberOfSilentAggregateTypes = dis.ReadUnsignedShort();
                    this._numberOfSilentEntityTypes    = dis.ReadUnsignedShort();
                    for (int idx = 0; idx < this.NumberOfDisAggregates; idx++)
                    {
                        AggregateID anX = new AggregateID();
                        anX.Unmarshal(dis);
                        this._aggregateIDList.Add(anX);
                    }
                    ;

                    for (int idx = 0; idx < this.NumberOfDisEntities; idx++)
                    {
                        EntityID anX = new EntityID();
                        anX.Unmarshal(dis);
                        this._entityIDList.Add(anX);
                    }
                    ;

                    this._pad2 = dis.ReadUnsignedByte();
                    for (int idx = 0; idx < this.NumberOfSilentAggregateTypes; idx++)
                    {
                        EntityType anX = new EntityType();
                        anX.Unmarshal(dis);
                        this._silentAggregateSystemList.Add(anX);
                    }
                    ;

                    for (int idx = 0; idx < this.NumberOfSilentEntityTypes; idx++)
                    {
                        EntityType anX = new EntityType();
                        anX.Unmarshal(dis);
                        this._silentEntitySystemList.Add(anX);
                    }
                    ;

                    this._numberOfVariableDatumRecords = dis.ReadUnsignedInt();
                    for (int idx = 0; idx < this.NumberOfVariableDatumRecords; idx++)
                    {
                        VariableDatum anX = new VariableDatum();
                        anX.Unmarshal(dis);
                        this._variableDatumList.Add(anX);
                    }
                    ;
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
        public override void Marshal(DataOutputStream dos)
        {
            base.Marshal(dos);
            if (dos != null)
            {
                try
                {
                    this._aggregateID.Marshal(dos);
                    dos.WriteUnsignedByte((byte)this._forceID);
                    dos.WriteUnsignedByte((byte)this._aggregateState);
                    this._aggregateType.Marshal(dos);
                    dos.WriteUnsignedInt((uint)this._formation);
                    this._aggregateMarking.Marshal(dos);
                    this._dimensions.Marshal(dos);
                    this._orientation.Marshal(dos);
                    this._centerOfMass.Marshal(dos);
                    this._velocity.Marshal(dos);
                    dos.WriteUnsignedShort((ushort)this._aggregateIDList.Count);
                    dos.WriteUnsignedShort((ushort)this._entityIDList.Count);
                    dos.WriteUnsignedShort((ushort)this._silentAggregateSystemList.Count);
                    dos.WriteUnsignedShort((ushort)this._silentEntitySystemList.Count);

                    for (int idx = 0; idx < this._aggregateIDList.Count; idx++)
                    {
                        AggregateID aAggregateID = (AggregateID)this._aggregateIDList[idx];
                        aAggregateID.Marshal(dos);
                    }

                    for (int idx = 0; idx < this._entityIDList.Count; idx++)
                    {
                        EntityID aEntityID = (EntityID)this._entityIDList[idx];
                        aEntityID.Marshal(dos);
                    }
                    dos.WriteUnsignedByte((byte)this._pad2);

                    for (int idx = 0; idx < this._silentAggregateSystemList.Count; idx++)
                    {
                        EntityType aEntityType = (EntityType)this._silentAggregateSystemList[idx];
                        aEntityType.Marshal(dos);
                    }

                    for (int idx = 0; idx < this._silentEntitySystemList.Count; idx++)
                    {
                        EntityType aEntityType = (EntityType)this._silentEntitySystemList[idx];
                        aEntityType.Marshal(dos);
                    }
                    dos.WriteUnsignedInt((uint)this._variableDatumList.Count);

                    for (int idx = 0; idx < this._variableDatumList.Count; idx++)
                    {
                        VariableDatum aVariableDatum = (VariableDatum)this._variableDatumList[idx];
                        aVariableDatum.Marshal(dos);
                    }
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }