Ejemplo n.º 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(AcousticBeamData obj)
        {
            bool ivarsEqual = true;

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

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

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

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

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

            return(ivarsEqual);
        }
        public virtual void Reflection(StringBuilder sb)
        {
            sb.AppendLine("<AcousticEmitterSystemData>");
            try
            {
                sb.AppendLine("<emitterSystemDataLength type=\"byte\">" + this._emitterSystemDataLength.ToString(CultureInfo.InvariantCulture) + "</emitterSystemDataLength>");
                sb.AppendLine("<beamRecords type=\"byte\">" + this._beamRecords.Count.ToString(CultureInfo.InvariantCulture) + "</beamRecords>");
                sb.AppendLine("<pad2 type=\"ushort\">" + this._pad2.ToString(CultureInfo.InvariantCulture) + "</pad2>");
                sb.AppendLine("<acousticEmitterSystem>");
                this._acousticEmitterSystem.Reflection(sb);
                sb.AppendLine("</acousticEmitterSystem>");
                sb.AppendLine("<emitterLocation>");
                this._emitterLocation.Reflection(sb);
                sb.AppendLine("</emitterLocation>");
                for (int idx = 0; idx < this._beamRecords.Count; idx++)
                {
                    sb.AppendLine("<beamRecords" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"AcousticBeamData\">");
                    AcousticBeamData aAcousticBeamData = (AcousticBeamData)this._beamRecords[idx];
                    aAcousticBeamData.Reflection(sb);
                    sb.AppendLine("</beamRecords" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

                sb.AppendLine("</AcousticEmitterSystemData>");
            }
            catch (Exception e)
            {
#if DEBUG
                Trace.WriteLine(e);
                Trace.Flush();
#endif
                this.OnException(e);
            }
        }
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._emitterSystemDataLength = dis.ReadUnsignedByte();
                    this._numberOfBeams           = dis.ReadUnsignedByte();
                    this._pad2 = dis.ReadUnsignedShort();
                    this._acousticEmitterSystem.Unmarshal(dis);
                    this._emitterLocation.Unmarshal(dis);
                    for (int idx = 0; idx < this.NumberOfBeams; idx++)
                    {
                        AcousticBeamData anX = new AcousticBeamData();
                        anX.Unmarshal(dis);
                        this._beamRecords.Add(anX);
                    }
                    ;
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
        public virtual void Marshal(DataOutputStream dos)
        {
            if (dos != null)
            {
                try
                {
                    dos.WriteUnsignedByte((byte)this._emitterSystemDataLength);
                    dos.WriteUnsignedByte((byte)this._beamRecords.Count);
                    dos.WriteUnsignedShort((ushort)this._pad2);
                    this._acousticEmitterSystem.Marshal(dos);
                    this._emitterLocation.Marshal(dos);

                    for (int idx = 0; idx < this._beamRecords.Count; idx++)
                    {
                        AcousticBeamData aAcousticBeamData = (AcousticBeamData)this._beamRecords[idx];
                        aAcousticBeamData.Marshal(dos);
                    }
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
        public virtual int GetMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize += 1;                                               // this._emitterSystemDataLength
            marshalSize += 1;                                               // this._numberOfBeams
            marshalSize += 2;                                               // this._pad2
            marshalSize += this._acousticEmitterSystem.GetMarshalledSize(); // this._acousticEmitterSystem
            marshalSize += this._emitterLocation.GetMarshalledSize();       // this._emitterLocation
            for (int idx = 0; idx < this._beamRecords.Count; idx++)
            {
                AcousticBeamData listElement = (AcousticBeamData)this._beamRecords[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

            return(marshalSize);
        }
        public virtual void Unmarshal(DataInputStream dis)
        {
            if (dis != null)
            {
                try
                {
                    this._emitterSystemDataLength = dis.ReadUnsignedByte();
                    this._numberOfBeams = dis.ReadUnsignedByte();
                    this._pad2 = dis.ReadUnsignedShort();
                    this._acousticEmitterSystem.Unmarshal(dis);
                    this._emitterLocation.Unmarshal(dis);
                    for (int idx = 0; idx < this.NumberOfBeams; idx++)
                    {
                        AcousticBeamData anX = new AcousticBeamData();
                        anX.Unmarshal(dis);
                        this._beamRecords.Add(anX);
                    };

                }
                catch (Exception e)
                {
            #if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
            #endif
                    this.OnException(e);
                }
            }
        }
Ejemplo n.º 7
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(AcousticBeamData obj)
        {
            bool ivarsEqual = true;

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

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

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

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

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

            return ivarsEqual;
        }