Пример #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(Vector3Double obj)
        {
            bool ivarsEqual = true;

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

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

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

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

            return(ivarsEqual);
        }
Пример #2
0
        public override void Marshal(DataOutputStream dos)
        {
            base.Marshal(dos);
            if (dos != null)
            {
                try
                {
                    this._objectID.Marshal(dos);
                    this._referencedObjectID.Marshal(dos);
                    dos.WriteUnsignedShort((ushort)this._updateNumber);
                    dos.WriteUnsignedByte((byte)this._forceID);
                    dos.WriteUnsignedByte((byte)this._modifications);
                    this._objectType.Marshal(dos);
                    dos.WriteUnsignedInt((uint)this._specificObjectAppearance);
                    dos.WriteUnsignedShort((ushort)this._generalObjectAppearance);
                    dos.WriteUnsignedShort((ushort)this._objectLocation.Count);
                    this._requesterID.Marshal(dos);
                    this._receivingID.Marshal(dos);

                    for (int idx = 0; idx < this._objectLocation.Count; idx++)
                    {
                        Vector3Double aVector3Double = (Vector3Double)this._objectLocation[idx];
                        aVector3Double.Marshal(dos);
                    }
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
Пример #3
0
        public override void Reflection(StringBuilder sb)
        {
            sb.AppendLine("<ArealObjectStatePdu>");
            base.Reflection(sb);
            try
            {
                sb.AppendLine("<objectID>");
                this._objectID.Reflection(sb);
                sb.AppendLine("</objectID>");
                sb.AppendLine("<referencedObjectID>");
                this._referencedObjectID.Reflection(sb);
                sb.AppendLine("</referencedObjectID>");
                sb.AppendLine("<updateNumber type=\"ushort\">" + this._updateNumber.ToString(CultureInfo.InvariantCulture) + "</updateNumber>");
                sb.AppendLine("<forceID type=\"byte\">" + this._forceID.ToString(CultureInfo.InvariantCulture) + "</forceID>");
                sb.AppendLine("<modifications type=\"byte\">" + this._modifications.ToString(CultureInfo.InvariantCulture) + "</modifications>");
                sb.AppendLine("<objectType>");
                this._objectType.Reflection(sb);
                sb.AppendLine("</objectType>");
                sb.AppendLine("<objectAppearance>");
                this._objectAppearance.Reflection(sb);
                sb.AppendLine("</objectAppearance>");
                sb.AppendLine("<objectLocation type=\"ushort\">" + this._objectLocation.Count.ToString(CultureInfo.InvariantCulture) + "</objectLocation>");
                sb.AppendLine("<requesterID>");
                this._requesterID.Reflection(sb);
                sb.AppendLine("</requesterID>");
                sb.AppendLine("<receivingID>");
                this._receivingID.Reflection(sb);
                sb.AppendLine("</receivingID>");
                for (int idx = 0; idx < this._objectLocation.Count; idx++)
                {
                    sb.AppendLine("<objectLocation" + idx.ToString(CultureInfo.InvariantCulture) + " type=\"Vector3Double\">");
                    Vector3Double aVector3Double = (Vector3Double)this._objectLocation[idx];
                    aVector3Double.Reflection(sb);
                    sb.AppendLine("</objectLocation" + idx.ToString(CultureInfo.InvariantCulture) + ">");
                }

                sb.AppendLine("</ArealObjectStatePdu>");
            }
            catch (Exception e)
            {
#if DEBUG
                Trace.WriteLine(e);
                Trace.Flush();
#endif
                this.OnException(e);
            }
        }
Пример #4
0
        public override int GetMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize  = base.GetMarshalledSize();
            marshalSize += this._objectID.GetMarshalledSize();           // this._objectID
            marshalSize += this._referencedObjectID.GetMarshalledSize(); // this._referencedObjectID
            marshalSize += 2;                                            // this._updateNumber
            marshalSize += 1;                                            // this._forceID
            marshalSize += 1;                                            // this._modifications
            marshalSize += this._objectType.GetMarshalledSize();         // this._objectType
            marshalSize += this._objectAppearance.GetMarshalledSize();   // this._objectAppearance
            marshalSize += 2;                                            // this._numberOfPoints
            marshalSize += this._requesterID.GetMarshalledSize();        // this._requesterID
            marshalSize += this._receivingID.GetMarshalledSize();        // this._receivingID
            for (int idx = 0; idx < this._objectLocation.Count; idx++)
            {
                Vector3Double listElement = (Vector3Double)this._objectLocation[idx];
                marshalSize += listElement.GetMarshalledSize();
            }

            return(marshalSize);
        }
Пример #5
0
        public override void Unmarshal(DataInputStream dis)
        {
            base.Unmarshal(dis);

            if (dis != null)
            {
                try
                {
                    this._objectID.Unmarshal(dis);
                    this._referencedObjectID.Unmarshal(dis);
                    this._updateNumber  = dis.ReadUnsignedShort();
                    this._forceID       = dis.ReadUnsignedByte();
                    this._modifications = dis.ReadUnsignedByte();
                    this._objectType.Unmarshal(dis);
                    this._specificObjectAppearance = dis.ReadUnsignedInt();
                    this._generalObjectAppearance  = dis.ReadUnsignedShort();
                    this._numberOfPoints           = dis.ReadUnsignedShort();
                    this._requesterID.Unmarshal(dis);
                    this._receivingID.Unmarshal(dis);
                    for (int idx = 0; idx < this.NumberOfPoints; idx++)
                    {
                        Vector3Double anX = new Vector3Double();
                        anX.Unmarshal(dis);
                        this._objectLocation.Add(anX);
                    }
                    ;
                }
                catch (Exception e)
                {
#if DEBUG
                    Trace.WriteLine(e);
                    Trace.Flush();
#endif
                    this.OnException(e);
                }
            }
        }
Пример #6
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(Vector3Double obj)
        {
            bool ivarsEqual = true;

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

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

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

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

            return ivarsEqual;
        }