} // end of marshal method

        new public void unmarshal(DataInputStream dis)
        {
            base.unmarshal(dis);

            try
            {
                _objectID.unmarshal(dis);
                _referencedObjectID.unmarshal(dis);
                _updateNumber     = dis.readUshort();
                _forceID          = dis.readByte();
                _numberOfSegments = dis.readByte();
                _requesterID.unmarshal(dis);
                _receivingID.unmarshal(dis);
                _objectType.unmarshal(dis);
                for (int idx = 0; idx < _numberOfSegments; idx++)
                {
                    LinearSegmentParameter anX = new LinearSegmentParameter();
                    anX.unmarshal(dis);
                    _linearSegmentParameters.Add(anX);
                }
                ;
            } // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of unmarshal method
///<summary>
///Marshal the data to the DataOutputStream.  Note: Length needs to be set before calling this method
///</summary>
        new public void marshal(DataOutputStream dos)
        {
            base.marshal(dos);
            try
            {
                _objectID.marshal(dos);
                _referencedObjectID.marshal(dos);
                dos.writeUshort((ushort)_updateNumber);
                dos.writeByte((byte)_forceID);
                dos.writeByte((byte)_linearSegmentParameters.Count);
                _requesterID.marshal(dos);
                _receivingID.marshal(dos);
                _objectType.marshal(dos);

                for (int idx = 0; idx < _linearSegmentParameters.Count; idx++)
                {
                    LinearSegmentParameter aLinearSegmentParameter = (LinearSegmentParameter)_linearSegmentParameters[idx];
                    aLinearSegmentParameter.marshal(dos);
                } // end of list marshalling
            }     // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of marshal method
        /**
         * The equals method doesn't always work--mostly on on classes that consist only of primitives. Be careful.
         */
        public bool equals(LinearObjectStatePdu rhs)
        {
            bool ivarsEqual = true;

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

            if (!(_objectID.Equals(rhs._objectID)))
            {
                ivarsEqual = false;
            }
            if (!(_referencedObjectID.Equals(rhs._referencedObjectID)))
            {
                ivarsEqual = false;
            }
            if (!(_updateNumber == rhs._updateNumber))
            {
                ivarsEqual = false;
            }
            if (!(_forceID == rhs._forceID))
            {
                ivarsEqual = false;
            }
            if (!(_numberOfSegments == rhs._numberOfSegments))
            {
                ivarsEqual = false;
            }
            if (!(_requesterID.Equals(rhs._requesterID)))
            {
                ivarsEqual = false;
            }
            if (!(_receivingID.Equals(rhs._receivingID)))
            {
                ivarsEqual = false;
            }
            if (!(_objectType.Equals(rhs._objectType)))
            {
                ivarsEqual = false;
            }

            for (int idx = 0; idx < _linearSegmentParameters.Count; idx++)
            {
                LinearSegmentParameter x = (LinearSegmentParameter)_linearSegmentParameters[idx];
                if (!(_linearSegmentParameters[idx].Equals(rhs._linearSegmentParameters[idx])))
                {
                    ivarsEqual = false;
                }
            }


            return(ivarsEqual);
        }
Пример #4
0
        /**
         * Compares for reference equality and value equality.
         */
        public bool equals(LinearSegmentParameter rhs)
        {
            bool ivarsEqual = true;

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


            if (!(_segmentNumber == rhs._segmentNumber))
            {
                ivarsEqual = false;
            }
            if (!(_segmentAppearance.Equals(rhs._segmentAppearance)))
            {
                ivarsEqual = false;
            }
            if (!(_location.Equals(rhs._location)))
            {
                ivarsEqual = false;
            }
            if (!(_orientation.Equals(rhs._orientation)))
            {
                ivarsEqual = false;
            }
            if (!(_segmentLength == rhs._segmentLength))
            {
                ivarsEqual = false;
            }
            if (!(_segmentWidth == rhs._segmentWidth))
            {
                ivarsEqual = false;
            }
            if (!(_segmentHeight == rhs._segmentHeight))
            {
                ivarsEqual = false;
            }
            if (!(_segmentDepth == rhs._segmentDepth))
            {
                ivarsEqual = false;
            }
            if (!(_pad1 == rhs._pad1))
            {
                ivarsEqual = false;
            }

            return(ivarsEqual);
        }
        } // end of unmarshal method

        ///<summary>
        ///This allows for a quick display of PDU data.  The current format is unacceptable and only used for debugging.
        ///This will be modified in the future to provide a better display.  Usage:
        ///pdu.GetType().InvokeMember("reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb });
        ///where pdu is an object representing a single pdu and sb is a StringBuilder.
        ///Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality
        ///</summary>
        new public void reflection(StringBuilder sb)
        {
            sb.Append("<LinearObjectStatePdu>" + System.Environment.NewLine);
            base.reflection(sb);
            try
            {
                sb.Append("<objectID>" + System.Environment.NewLine);
                _objectID.reflection(sb);
                sb.Append("</objectID>" + System.Environment.NewLine);
                sb.Append("<referencedObjectID>" + System.Environment.NewLine);
                _referencedObjectID.reflection(sb);
                sb.Append("</referencedObjectID>" + System.Environment.NewLine);
                sb.Append("<updateNumber type=\"ushort\">" + _updateNumber.ToString() + "</updateNumber> " + System.Environment.NewLine);
                sb.Append("<forceID type=\"byte\">" + _forceID.ToString() + "</forceID> " + System.Environment.NewLine);
                sb.Append("<linearSegmentParameters type=\"byte\">" + _linearSegmentParameters.Count.ToString() + "</linearSegmentParameters> " + System.Environment.NewLine);
                sb.Append("<requesterID>" + System.Environment.NewLine);
                _requesterID.reflection(sb);
                sb.Append("</requesterID>" + System.Environment.NewLine);
                sb.Append("<receivingID>" + System.Environment.NewLine);
                _receivingID.reflection(sb);
                sb.Append("</receivingID>" + System.Environment.NewLine);
                sb.Append("<objectType>" + System.Environment.NewLine);
                _objectType.reflection(sb);
                sb.Append("</objectType>" + System.Environment.NewLine);

                for (int idx = 0; idx < _linearSegmentParameters.Count; idx++)
                {
                    sb.Append("<linearSegmentParameters" + idx.ToString() + " type=\"LinearSegmentParameter\">" + System.Environment.NewLine);
                    LinearSegmentParameter aLinearSegmentParameter = (LinearSegmentParameter)_linearSegmentParameters[idx];
                    aLinearSegmentParameter.reflection(sb);
                    sb.Append("</linearSegmentParameters" + idx.ToString() + ">" + System.Environment.NewLine);
                } // end of list marshalling

                sb.Append("</LinearObjectStatePdu>" + System.Environment.NewLine);
            } // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of marshal method
        new public int getMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize = base.getMarshalledSize();
            marshalSize = marshalSize + _objectID.getMarshalledSize();           // _objectID
            marshalSize = marshalSize + _referencedObjectID.getMarshalledSize(); // _referencedObjectID
            marshalSize = marshalSize + 2;                                       // _updateNumber
            marshalSize = marshalSize + 1;                                       // _forceID
            marshalSize = marshalSize + 1;                                       // _numberOfSegments
            marshalSize = marshalSize + _requesterID.getMarshalledSize();        // _requesterID
            marshalSize = marshalSize + _receivingID.getMarshalledSize();        // _receivingID
            marshalSize = marshalSize + _objectType.getMarshalledSize();         // _objectType
            for (int idx = 0; idx < _linearSegmentParameters.Count; idx++)
            {
                LinearSegmentParameter listElement = (LinearSegmentParameter)_linearSegmentParameters[idx];
                marshalSize = marshalSize + listElement.getMarshalledSize();
            }

            return(marshalSize);
        }
        /**
         * Compares for reference equality and value equality.
         */
        public bool equals(LinearSegmentParameter rhs)
        {
            bool ivarsEqual = true;

            if(rhs.GetType() != this.GetType())
                return false;

            if( ! (_segmentNumber == rhs._segmentNumber)) ivarsEqual = false;
            if( ! (_segmentAppearance.Equals( rhs._segmentAppearance) )) ivarsEqual = false;
            if( ! (_location.Equals( rhs._location) )) ivarsEqual = false;
            if( ! (_orientation.Equals( rhs._orientation) )) ivarsEqual = false;
            if( ! (_segmentLength == rhs._segmentLength)) ivarsEqual = false;
            if( ! (_segmentWidth == rhs._segmentWidth)) ivarsEqual = false;
            if( ! (_segmentHeight == rhs._segmentHeight)) ivarsEqual = false;
            if( ! (_segmentDepth == rhs._segmentDepth)) ivarsEqual = false;
            if( ! (_pad1 == rhs._pad1)) ivarsEqual = false;

            return ivarsEqual;
        }
        public new void unmarshal(DataInputStream dis)
        {
            base.unmarshal(dis);

            try
            {
               _objectID.unmarshal(dis);
               _referencedObjectID.unmarshal(dis);
               _updateNumber = dis.readUshort();
               _forceID = dis.readByte();
               _numberOfSegments = dis.readByte();
               _requesterID.unmarshal(dis);
               _receivingID.unmarshal(dis);
               _objectType.unmarshal(dis);
            for(int idx = 0; idx < _numberOfSegments; idx++)
            {
               LinearSegmentParameter anX = new LinearSegmentParameter();
            anX.unmarshal(dis);
            _linearSegmentParameters.Add(anX);
            };

            } // end try
               catch(Exception e)
            {
              Trace.WriteLine(e);
              Trace.Flush();
            }
        }