Exemplo n.º 1
0
        /**
         * Compares for reference equality and value equality.
         */
        public bool equals(TransmitterPdu rhs)
        {
            bool ivarsEqual = true;

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

            ivarsEqual = base.Equals(rhs);

            if( ! (_radioEntityType.Equals( rhs._radioEntityType) )) ivarsEqual = false;
            if( ! (_transmitState == rhs._transmitState)) ivarsEqual = false;
            if( ! (_inputSource == rhs._inputSource)) ivarsEqual = false;
            if( ! (_padding1 == rhs._padding1)) ivarsEqual = false;
            if( ! (_antennaLocation.Equals( rhs._antennaLocation) )) ivarsEqual = false;
            if( ! (_relativeAntennaLocation.Equals( rhs._relativeAntennaLocation) )) ivarsEqual = false;
            if( ! (_antennaPatternType == rhs._antennaPatternType)) ivarsEqual = false;
            if( ! (_antennaPatternCount == rhs._antennaPatternCount)) ivarsEqual = false;
            if( ! (_frequency == rhs._frequency)) ivarsEqual = false;
            if( ! (_transmitFrequencyBandwidth == rhs._transmitFrequencyBandwidth)) ivarsEqual = false;
            if( ! (_power == rhs._power)) ivarsEqual = false;
            if( ! (_modulationType.Equals( rhs._modulationType) )) ivarsEqual = false;
            if( ! (_cryptoSystem == rhs._cryptoSystem)) ivarsEqual = false;
            if( ! (_cryptoKeyId == rhs._cryptoKeyId)) ivarsEqual = false;
            if( ! (_modulationParameterCount == rhs._modulationParameterCount)) ivarsEqual = false;
            if( ! (_padding2 == rhs._padding2)) ivarsEqual = false;
            if( ! (_padding3 == rhs._padding3)) ivarsEqual = false;

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

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

            return ivarsEqual;
        }
Exemplo n.º 2
0
        /**
         * The equals method doesn't always work--mostly on on classes that consist only of primitives. Be careful.
         */
        public bool equals(TransmitterPdu rhs)
        {
            bool ivarsEqual = true;

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

            if (!(_radioEntityType.Equals(rhs._radioEntityType)))
            {
                ivarsEqual = false;
            }
            if (!(_transmitState == rhs._transmitState))
            {
                ivarsEqual = false;
            }
            if (!(_inputSource == rhs._inputSource))
            {
                ivarsEqual = false;
            }
            if (!(_padding1 == rhs._padding1))
            {
                ivarsEqual = false;
            }
            if (!(_antennaLocation.Equals(rhs._antennaLocation)))
            {
                ivarsEqual = false;
            }
            if (!(_relativeAntennaLocation.Equals(rhs._relativeAntennaLocation)))
            {
                ivarsEqual = false;
            }
            if (!(_antennaPatternType == rhs._antennaPatternType))
            {
                ivarsEqual = false;
            }
            if (!(_antennaPatternCount == rhs._antennaPatternCount))
            {
                ivarsEqual = false;
            }
            if (!(_frequency == rhs._frequency))
            {
                ivarsEqual = false;
            }
            if (!(_transmitFrequencyBandwidth == rhs._transmitFrequencyBandwidth))
            {
                ivarsEqual = false;
            }
            if (!(_power == rhs._power))
            {
                ivarsEqual = false;
            }
            if (!(_modulationType.Equals(rhs._modulationType)))
            {
                ivarsEqual = false;
            }
            if (!(_cryptoSystem == rhs._cryptoSystem))
            {
                ivarsEqual = false;
            }
            if (!(_cryptoKeyId == rhs._cryptoKeyId))
            {
                ivarsEqual = false;
            }
            if (!(_modulationParameterCount == rhs._modulationParameterCount))
            {
                ivarsEqual = false;
            }
            if (!(_padding2 == rhs._padding2))
            {
                ivarsEqual = false;
            }
            if (!(_padding3 == rhs._padding3))
            {
                ivarsEqual = false;
            }

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


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


            return(ivarsEqual);
        }
Exemplo n.º 3
0
        public static DIS1998net.Pdu GetPDU(DISnet.Utilities.PDUTypes.PDUType1998 pdu_type)
        {
            DIS1998net.Pdu pdu = null;

            switch (pdu_type)
            {

                case PDUTypes.PDUType1998.PDU_ENTITY_STATE: pdu =  new EntityStatePdu(); break;
                case PDUTypes.PDUType1998.PDU_FIRE: pdu = new FirePdu(); break;
                case PDUTypes.PDUType1998.PDU_DETONATION: pdu = new DetonationPdu(); break;
                case PDUTypes.PDUType1998.PDU_COLLISION: pdu = new CollisionPdu(); break;
                case PDUTypes.PDUType1998.PDU_SERVICE_REQUEST: pdu = new ServiceRequestPdu(); break;
                case PDUTypes.PDUType1998.PDU_RESUPPLY_OFFER: pdu = new ResupplyOfferPdu(); break;
                case PDUTypes.PDUType1998.PDU_RESUPPLY_RECEIVED: pdu = new ResupplyReceivedPdu(); break;
                case PDUTypes.PDUType1998.PDU_RESUPPLY_CANCEL: pdu = new ResupplyCancelPdu(); break;
                case PDUTypes.PDUType1998.PDU_REPAIR_COMPLETE: pdu = new RepairCompletePdu(); break;
                case PDUTypes.PDUType1998.PDU_REPAIR_RESPONSE: pdu = new RepairResponsePdu(); break;
                case PDUTypes.PDUType1998.PDU_CREATE_ENTITY: pdu = new CreateEntityPdu(); break;
                case PDUTypes.PDUType1998.PDU_REMOVE_ENTITY: pdu = new RemoveEntityPdu(); break;
                case PDUTypes.PDUType1998.PDU_START_RESUME: pdu = new StartResumePdu(); break;
                case PDUTypes.PDUType1998.PDU_ACKNOWLEDGE: pdu = new AcknowledgePdu(); break;
                case PDUTypes.PDUType1998.PDU_ACTION_REQUEST: pdu = new ActionRequestPdu(); break;
                case PDUTypes.PDUType1998.PDU_ACTION_RESPONSE: pdu = new ActionResponsePdu(); break;
                case PDUTypes.PDUType1998.PDU_DATA_QUERY: pdu = new DataQueryPdu(); break;
                case PDUTypes.PDUType1998.PDU_SET_DATA: pdu = new SetDataPdu(); break;
                case PDUTypes.PDUType1998.PDU_EVENT_REPORT: pdu = new EventReportPdu(); break;
                case PDUTypes.PDUType1998.PDU_COMMENT: pdu = new CommentPdu(); break;
                case PDUTypes.PDUType1998.PDU_STOP_FREEZE: pdu = new StopFreezePdu(); break;
                case PDUTypes.PDUType1998.PDU_SIGNAL: pdu = new SignalPdu(); break;
                case PDUTypes.PDUType1998.PDU_TRANSMITTER: pdu = new TransmitterPdu(); break;
            }

            return pdu;
        }