示例#1
0
        /**
         * Compares for reference equality and value equality.
         */
        public bool equals(AggregateID rhs)
        {
            bool ivarsEqual = true;

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


            if (!(_site == rhs._site))
            {
                ivarsEqual = false;
            }
            if (!(_application == rhs._application))
            {
                ivarsEqual = false;
            }
            if (!(_aggregateID == rhs._aggregateID))
            {
                ivarsEqual = false;
            }

            return(ivarsEqual);
        }
示例#2
0
        new public int getMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize = base.getMarshalledSize();
            marshalSize = marshalSize + _aggregateID.getMarshalledSize();      // _aggregateID
            marshalSize = marshalSize + 1;                                     // _forceID
            marshalSize = marshalSize + 1;                                     // _aggregateState
            marshalSize = marshalSize + _aggregateType.getMarshalledSize();    // _aggregateType
            marshalSize = marshalSize + 4;                                     // _formation
            marshalSize = marshalSize + _aggregateMarking.getMarshalledSize(); // _aggregateMarking
            marshalSize = marshalSize + _dimensions.getMarshalledSize();       // _dimensions
            marshalSize = marshalSize + _orientation.getMarshalledSize();      // _orientation
            marshalSize = marshalSize + _centerOfMass.getMarshalledSize();     // _centerOfMass
            marshalSize = marshalSize + _velocity.getMarshalledSize();         // _velocity
            marshalSize = marshalSize + 2;                                     // _numberOfDisAggregates
            marshalSize = marshalSize + 2;                                     // _numberOfDisEntities
            marshalSize = marshalSize + 2;                                     // _numberOfSilentAggregateTypes
            marshalSize = marshalSize + 2;                                     // _numberOfSilentEntityTypes
            for (int idx = 0; idx < _aggregateIDList.Count; idx++)
            {
                AggregateID listElement = (AggregateID)_aggregateIDList[idx];
                marshalSize = marshalSize + listElement.getMarshalledSize();
            }
            for (int idx = 0; idx < _entityIDList.Count; idx++)
            {
                EntityID listElement = (EntityID)_entityIDList[idx];
                marshalSize = marshalSize + listElement.getMarshalledSize();
            }
            marshalSize = marshalSize + 1; // _pad2
            for (int idx = 0; idx < _silentAggregateSystemList.Count; idx++)
            {
                EntityType listElement = (EntityType)_silentAggregateSystemList[idx];
                marshalSize = marshalSize + listElement.getMarshalledSize();
            }
            for (int idx = 0; idx < _silentEntitySystemList.Count; idx++)
            {
                EntityType listElement = (EntityType)_silentEntitySystemList[idx];
                marshalSize = marshalSize + listElement.getMarshalledSize();
            }
            marshalSize = marshalSize + 4; // _numberOfVariableDatumRecords
            for (int idx = 0; idx < _variableDatumList.Count; idx++)
            {
                VariableDatum listElement = (VariableDatum)_variableDatumList[idx];
                marshalSize = marshalSize + listElement.getMarshalledSize();
            }

            return(marshalSize);
        }
示例#3
0
        } // 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("<AggregateStatePdu>" + System.Environment.NewLine);
            base.reflection(sb);
            try
            {
                sb.Append("<aggregateID>" + System.Environment.NewLine);
                _aggregateID.reflection(sb);
                sb.Append("</aggregateID>" + System.Environment.NewLine);
                sb.Append("<forceID type=\"byte\">" + _forceID.ToString() + "</forceID> " + System.Environment.NewLine);
                sb.Append("<aggregateState type=\"byte\">" + _aggregateState.ToString() + "</aggregateState> " + System.Environment.NewLine);
                sb.Append("<aggregateType>" + System.Environment.NewLine);
                _aggregateType.reflection(sb);
                sb.Append("</aggregateType>" + System.Environment.NewLine);
                sb.Append("<formation type=\"uint\">" + _formation.ToString() + "</formation> " + System.Environment.NewLine);
                sb.Append("<aggregateMarking>" + System.Environment.NewLine);
                _aggregateMarking.reflection(sb);
                sb.Append("</aggregateMarking>" + System.Environment.NewLine);
                sb.Append("<dimensions>" + System.Environment.NewLine);
                _dimensions.reflection(sb);
                sb.Append("</dimensions>" + System.Environment.NewLine);
                sb.Append("<orientation>" + System.Environment.NewLine);
                _orientation.reflection(sb);
                sb.Append("</orientation>" + System.Environment.NewLine);
                sb.Append("<centerOfMass>" + System.Environment.NewLine);
                _centerOfMass.reflection(sb);
                sb.Append("</centerOfMass>" + System.Environment.NewLine);
                sb.Append("<velocity>" + System.Environment.NewLine);
                _velocity.reflection(sb);
                sb.Append("</velocity>" + System.Environment.NewLine);
                sb.Append("<aggregateIDList type=\"ushort\">" + _aggregateIDList.Count.ToString() + "</aggregateIDList> " + System.Environment.NewLine);
                sb.Append("<entityIDList type=\"ushort\">" + _entityIDList.Count.ToString() + "</entityIDList> " + System.Environment.NewLine);
                sb.Append("<silentAggregateSystemList type=\"ushort\">" + _silentAggregateSystemList.Count.ToString() + "</silentAggregateSystemList> " + System.Environment.NewLine);
                sb.Append("<silentEntitySystemList type=\"ushort\">" + _silentEntitySystemList.Count.ToString() + "</silentEntitySystemList> " + System.Environment.NewLine);

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


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

                sb.Append("<pad2 type=\"byte\">" + _pad2.ToString() + "</pad2> " + System.Environment.NewLine);

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


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

                sb.Append("<variableDatumList type=\"uint\">" + _variableDatumList.Count.ToString() + "</variableDatumList> " + System.Environment.NewLine);

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

                sb.Append("</AggregateStatePdu>" + System.Environment.NewLine);
            } // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of marshal method
示例#4
0
        } // end of marshal method

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

            try
            {
                _aggregateID.unmarshal(dis);
                _forceID        = dis.readByte();
                _aggregateState = dis.readByte();
                _aggregateType.unmarshal(dis);
                _formation = dis.readUint();
                _aggregateMarking.unmarshal(dis);
                _dimensions.unmarshal(dis);
                _orientation.unmarshal(dis);
                _centerOfMass.unmarshal(dis);
                _velocity.unmarshal(dis);
                _numberOfDisAggregates        = dis.readUshort();
                _numberOfDisEntities          = dis.readUshort();
                _numberOfSilentAggregateTypes = dis.readUshort();
                _numberOfSilentEntityTypes    = dis.readUshort();
                for (int idx = 0; idx < _numberOfDisAggregates; idx++)
                {
                    AggregateID anX = new AggregateID();
                    anX.unmarshal(dis);
                    _aggregateIDList.Add(anX);
                }
                ;

                for (int idx = 0; idx < _numberOfDisEntities; idx++)
                {
                    EntityID anX = new EntityID();
                    anX.unmarshal(dis);
                    _entityIDList.Add(anX);
                }
                ;

                _pad2 = dis.readByte();
                for (int idx = 0; idx < _numberOfSilentAggregateTypes; idx++)
                {
                    EntityType anX = new EntityType();
                    anX.unmarshal(dis);
                    _silentAggregateSystemList.Add(anX);
                }
                ;

                for (int idx = 0; idx < _numberOfSilentEntityTypes; idx++)
                {
                    EntityType anX = new EntityType();
                    anX.unmarshal(dis);
                    _silentEntitySystemList.Add(anX);
                }
                ;

                _numberOfVariableDatumRecords = dis.readUint();
                for (int idx = 0; idx < _numberOfVariableDatumRecords; idx++)
                {
                    VariableDatum anX = new VariableDatum();
                    anX.unmarshal(dis);
                    _variableDatumList.Add(anX);
                }
                ;
            } // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of unmarshal method
示例#5
0
///<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
            {
                _aggregateID.marshal(dos);
                dos.writeByte((byte)_forceID);
                dos.writeByte((byte)_aggregateState);
                _aggregateType.marshal(dos);
                dos.writeUint((uint)_formation);
                _aggregateMarking.marshal(dos);
                _dimensions.marshal(dos);
                _orientation.marshal(dos);
                _centerOfMass.marshal(dos);
                _velocity.marshal(dos);
                dos.writeUshort((ushort)_aggregateIDList.Count);
                dos.writeUshort((ushort)_entityIDList.Count);
                dos.writeUshort((ushort)_silentAggregateSystemList.Count);
                dos.writeUshort((ushort)_silentEntitySystemList.Count);

                for (int idx = 0; idx < _aggregateIDList.Count; idx++)
                {
                    AggregateID aAggregateID = (AggregateID)_aggregateIDList[idx];
                    aAggregateID.marshal(dos);
                } // end of list marshalling


                for (int idx = 0; idx < _entityIDList.Count; idx++)
                {
                    EntityID aEntityID = (EntityID)_entityIDList[idx];
                    aEntityID.marshal(dos);
                } // end of list marshalling

                dos.writeByte((byte)_pad2);

                for (int idx = 0; idx < _silentAggregateSystemList.Count; idx++)
                {
                    EntityType aEntityType = (EntityType)_silentAggregateSystemList[idx];
                    aEntityType.marshal(dos);
                } // end of list marshalling


                for (int idx = 0; idx < _silentEntitySystemList.Count; idx++)
                {
                    EntityType aEntityType = (EntityType)_silentEntitySystemList[idx];
                    aEntityType.marshal(dos);
                } // end of list marshalling

                dos.writeUint((uint)_variableDatumList.Count);

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

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

            if (!(_aggregateID.Equals(rhs._aggregateID)))
            {
                ivarsEqual = false;
            }
            if (!(_forceID == rhs._forceID))
            {
                ivarsEqual = false;
            }
            if (!(_aggregateState == rhs._aggregateState))
            {
                ivarsEqual = false;
            }
            if (!(_aggregateType.Equals(rhs._aggregateType)))
            {
                ivarsEqual = false;
            }
            if (!(_formation == rhs._formation))
            {
                ivarsEqual = false;
            }
            if (!(_aggregateMarking.Equals(rhs._aggregateMarking)))
            {
                ivarsEqual = false;
            }
            if (!(_dimensions.Equals(rhs._dimensions)))
            {
                ivarsEqual = false;
            }
            if (!(_orientation.Equals(rhs._orientation)))
            {
                ivarsEqual = false;
            }
            if (!(_centerOfMass.Equals(rhs._centerOfMass)))
            {
                ivarsEqual = false;
            }
            if (!(_velocity.Equals(rhs._velocity)))
            {
                ivarsEqual = false;
            }
            if (!(_numberOfDisAggregates == rhs._numberOfDisAggregates))
            {
                ivarsEqual = false;
            }
            if (!(_numberOfDisEntities == rhs._numberOfDisEntities))
            {
                ivarsEqual = false;
            }
            if (!(_numberOfSilentAggregateTypes == rhs._numberOfSilentAggregateTypes))
            {
                ivarsEqual = false;
            }
            if (!(_numberOfSilentEntityTypes == rhs._numberOfSilentEntityTypes))
            {
                ivarsEqual = false;
            }

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


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

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

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


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

            if (!(_numberOfVariableDatumRecords == rhs._numberOfVariableDatumRecords))
            {
                ivarsEqual = false;
            }

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


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

            try
            {
               _aggregateID.unmarshal(dis);
               _forceID = dis.readByte();
               _aggregateState = dis.readByte();
               _aggregateType.unmarshal(dis);
               _formation = dis.readUint();
               _aggregateMarking.unmarshal(dis);
               _dimensions.unmarshal(dis);
               _orientation.unmarshal(dis);
               _centerOfMass.unmarshal(dis);
               _velocity.unmarshal(dis);
               _numberOfDisAggregates = dis.readUshort();
               _numberOfDisEntities = dis.readUshort();
               _numberOfSilentAggregateTypes = dis.readUshort();
               _numberOfSilentEntityTypes = dis.readUshort();
            for(int idx = 0; idx < _numberOfDisAggregates; idx++)
            {
               AggregateID anX = new AggregateID();
            anX.unmarshal(dis);
            _aggregateIDList.Add(anX);
            };

            for(int idx = 0; idx < _numberOfDisEntities; idx++)
            {
               EntityID anX = new EntityID();
            anX.unmarshal(dis);
            _entityIDList.Add(anX);
            };

               _pad2 = dis.readByte();
            for(int idx = 0; idx < _numberOfSilentAggregateTypes; idx++)
            {
               EntityType anX = new EntityType();
            anX.unmarshal(dis);
            _silentAggregateSystemList.Add(anX);
            };

            for(int idx = 0; idx < _numberOfSilentEntityTypes; idx++)
            {
               EntityType anX = new EntityType();
            anX.unmarshal(dis);
            _silentEntitySystemList.Add(anX);
            };

               _numberOfVariableDatumRecords = dis.readUint();
            for(int idx = 0; idx < _numberOfVariableDatumRecords; idx++)
            {
               VariableDatum anX = new VariableDatum();
            anX.unmarshal(dis);
            _variableDatumList.Add(anX);
            };

            } // end try
               catch(Exception e)
            {
              Trace.WriteLine(e);
              Trace.Flush();
            }
        }
示例#8
0
        /**
          * The equals method doesn't always work--mostly on on classes that consist only of primitives. Be careful.
          */
        public bool equals(AggregateID rhs)
        {
            bool ivarsEqual = true;

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

             if( ! (_site == rhs._site)) ivarsEqual = false;
             if( ! (_application == rhs._application)) ivarsEqual = false;
             if( ! (_aggregateID == rhs._aggregateID)) ivarsEqual = false;

            return ivarsEqual;
        }