Class Pdu

java.lang.Object
edu.nps.moves.dis7.pdus.Pdu
All Implemented Interfaces:
Marshaller, Serializable
Direct Known Subclasses:
LiveEntityFamilyPdu, PduBase

public abstract class Pdu extends Object implements Serializable, Marshaller
Base class of PduBase and LiveEntityPdu
See Also:
  • Field Details

    • NAME

      public static final String NAME
      The name of this PDU type
      See Also:
    • protocolVersion

      protected DISProtocolVersion protocolVersion
      The version of the protocol. 5=DIS-1995, 6=DIS-1998, 7=DIS-2012 uid 3
    • exerciseID

      protected byte exerciseID
      Exercise ID provides a unique identifier
    • pduType

      protected DisPduType pduType
      Type of pdu, unique for each PDU class uid 4
    • protocolFamily

      protected DISProtocolFamily protocolFamily
      value that refers to the protocol family, eg SimulationManagement, et uid 5
    • timestamp

      protected int timestamp
      Timestamp value, int representing number of 1.675 microseconds as interval past hour
    • length

      protected short length
      Length, in bytes, of the PDU
  • Constructor Details

    • Pdu

      public Pdu()
      Constructor creates and configures a new instance object
  • Method Details

    • isReliablePdu

      public boolean isReliablePdu()
      Whether this instance is a Reliable Pdu with guaranteed delivery
      Returns:
      whether reliable
    • isDistributedEmissionsRegenerationFamilyPdu

      public boolean isDistributedEmissionsRegenerationFamilyPdu()
      Whether this instance has a DistributedEmissionsRegenerationFamilyPdu superclass
      Returns:
      whether this supertype is inherited
    • isEntityInformationInteractionFamilyPdu

      public boolean isEntityInformationInteractionFamilyPdu()
      Whether this instance has an EntityInformationInteractionFamilyPdu superclass
      Returns:
      whether this supertype is inherited
    • isEntityManagementFamilyPdu

      public boolean isEntityManagementFamilyPdu()
      Whether this instance has an EntityManagementFamilyPdu superclass
      Returns:
      whether this supertype is inherited
    • isInformationOperationsFamilyPdu

      public boolean isInformationOperationsFamilyPdu()
      Whether this instance has an InformationOperationsFamilyPdu superclass
      Returns:
      whether this supertype is inherited
    • isLogisticsFamilyPdu

      public boolean isLogisticsFamilyPdu()
      Whether this instance has a LogisticsFamilyPdu superclass
      Returns:
      whether this supertype is inherited
    • isMinefieldFamilyPdu

      public boolean isMinefieldFamilyPdu()
      Whether this instance has a MinefieldFamilyPdu superclass
      Returns:
      whether this supertype is inherited
    • isRadioCommunicationsFamilyPdu

      public boolean isRadioCommunicationsFamilyPdu()
      Whether this instance has a RadioCommunicationsFamilyPdu superclass
      Returns:
      whether this supertype is inherited
    • isSimulationManagementFamilyPdu

      public boolean isSimulationManagementFamilyPdu()
      Whether this instance has a SimulationManagementFamilyPdu superclass
      Returns:
      whether this supertype is inherited
    • isSimulationManagementWithReliabilityFamilyPdu

      public boolean isSimulationManagementWithReliabilityFamilyPdu()
      Whether this instance has a SimulationManagementWithReliabilityFamilyPdu superclass
      Returns:
      whether this supertype is inherited
    • isSyntheticEnvironmentFamilyPdu

      public boolean isSyntheticEnvironmentFamilyPdu()
      Whether this instance has a SyntheticEnvironmentFamilyPdu superclass
      Returns:
      whether this supertype is inherited
    • isWarfareFamilyPdu

      public boolean isWarfareFamilyPdu()
      Whether this instance has a WarfareFamilyPdu superclass
      Returns:
      whether this supertype is inherited
    • isAcknowledgeRPdu

      public boolean isAcknowledgeRPdu()
      Whether this instance is an AcknowledgeRPdu
      Returns:
      whether this type of Pdu
    • isActionRequestPdu

      public boolean isActionRequestPdu()
      Whether this instance is an ActionRequestPdu
      Returns:
      whether this type of Pdu
    • isActionRequestRPdu

      public boolean isActionRequestRPdu()
      Whether this instance is an ActionRequestRPdu
      Returns:
      whether this type of Pdu
    • isActionResponsePdu

      public boolean isActionResponsePdu()
      Whether this instance is an ActionResponsePdu
      Returns:
      whether this type of Pdu
    • isActionResponseRPdu

      public boolean isActionResponseRPdu()
      Whether this instance is an ActionResponseRPdu
      Returns:
      whether this type of Pdu
    • isAggregateStatePdu

      public boolean isAggregateStatePdu()
      Whether this instance is an AggregateStatePdu
      Returns:
      whether this type of Pdu
    • isAppearancePdu

      public boolean isAppearancePdu()
      Whether this instance is an AppearancePdu
      Returns:
      whether this type of Pdu
    • isArealObjectStatePdu

      public boolean isArealObjectStatePdu()
      Whether this instance is an ArealObjectStatePdu
      Returns:
      whether this type of Pdu
    • isArticulatedPartsPdu

      public boolean isArticulatedPartsPdu()
      Whether this instance is an ArticulatedPartsPdu
      Returns:
      whether this type of Pdu
    • isAttributePdu

      public boolean isAttributePdu()
      Whether this instance is an AttributePdu
      Returns:
      whether this type of Pdu
    • isCollisionElasticPdu

      public boolean isCollisionElasticPdu()
      Whether this instance is an CollisionElasticPdu
      Returns:
      whether this type of Pdu
    • isCollisionPdu

      public boolean isCollisionPdu()
      Whether this instance is an CollisionPdu
      Returns:
      whether this type of Pdu
    • isCommentPdu

      public boolean isCommentPdu()
      Whether this instance is an CommentPdu
      Returns:
      whether this type of Pdu
    • isCommentRPdu

      public boolean isCommentRPdu()
      Whether this instance is an CommentRPdu
      Returns:
      whether this type of Pdu
    • isCreateEntityPdu

      public boolean isCreateEntityPdu()
      Whether this instance is an CreateEntityPdu
      Returns:
      whether this type of Pdu
    • isCreateEntityRPdu

      public boolean isCreateEntityRPdu()
      Whether this instance is an CreateEntityRPdu
      Returns:
      whether this type of Pdu
    • isDataPdu

      public boolean isDataPdu()
      Whether this instance is an DataPdu
      Returns:
      whether this type of Pdu
    • isDataQueryPdu

      public boolean isDataQueryPdu()
      Whether this instance is an DataQueryPdu
      Returns:
      whether this type of Pdu
    • isDataQueryRPdu

      public boolean isDataQueryRPdu()
      Whether this instance is an DataQueryRPdu
      Returns:
      whether this type of Pdu
    • isDataRPdu

      public boolean isDataRPdu()
      Whether this instance is an DataRPdu
      Returns:
      whether this type of Pdu
    • isDesignatorPdu

      public boolean isDesignatorPdu()
      Whether this instance is an DesignatorPdu
      Returns:
      whether this type of Pdu
    • isDetonationPdu

      public boolean isDetonationPdu()
      Whether this instance is an DetonationPdu
      Returns:
      whether this type of Pdu
    • isDirectedEnergyFirePdu

      public boolean isDirectedEnergyFirePdu()
      Whether this instance is an DirectedEnergyFirePdu
      Returns:
      whether this type of Pdu
    • isElectromagneticEmissionPdu

      public boolean isElectromagneticEmissionPdu()
      Whether this instance is an ElectromagneticEmissionPdu
      Returns:
      whether this type of Pdu
    • isEntityDamageStatusPdu

      public boolean isEntityDamageStatusPdu()
      Whether this instance is an EntityDamageStatusPdu
      Returns:
      whether this type of Pdu
    • isEntityStatePdu

      public boolean isEntityStatePdu()
      Whether this instance is an EntityStatePdu
      Returns:
      whether this type of Pdu
    • isEntityStateUpdatePdu

      public boolean isEntityStateUpdatePdu()
      Whether this instance is an EntityStateUpdatePdu
      Returns:
      whether this type of Pdu
    • isEnvironmentalProcessPdu

      public boolean isEnvironmentalProcessPdu()
      Whether this instance is an EnvironmentalProcessPdu
      Returns:
      whether this type of Pdu
    • isEventReportPdu

      public boolean isEventReportPdu()
      Whether this instance is an EventReportPdu
      Returns:
      whether this type of Pdu
    • isEventReportRPdu

      public boolean isEventReportRPdu()
      Whether this instance is an EventReportRPdu
      Returns:
      whether this type of Pdu
    • isFirePdu

      public boolean isFirePdu()
      Whether this instance is an FirePdu
      Returns:
      whether this type of Pdu
    • isGriddedDataPdu

      public boolean isGriddedDataPdu()
      Whether this instance is an GriddedDataPdu
      Returns:
      whether this type of Pdu
    • isIFFPdu

      public boolean isIFFPdu()
      Whether this instance is an IFFPdu
      Returns:
      whether this type of Pdu
    • isInformationOperationsActionPdu

      public boolean isInformationOperationsActionPdu()
      Whether this instance is an InformationOperationsActionPdu
      Returns:
      whether this type of Pdu
    • isInformationOperationsReportPdu

      public boolean isInformationOperationsReportPdu()
      Whether this instance is an InformationOperationsReportPdu
      Returns:
      whether this type of Pdu
    • isIntercomControlPdu

      public boolean isIntercomControlPdu()
      Whether this instance is an IntercomControlPdu
      Returns:
      whether this type of Pdu
    • isIntercomSignalPdu

      public boolean isIntercomSignalPdu()
      Whether this instance is an IntercomSignalPdu
      Returns:
      whether this type of Pdu
    • isIsGroupOfPdu

      public boolean isIsGroupOfPdu()
      Whether this instance is an IsGroupOfPdu
      Returns:
      whether this type of Pdu
    • isIsPartOfPdu

      public boolean isIsPartOfPdu()
      Whether this instance is an IsPartOfPdu
      Returns:
      whether this type of Pdu
    • isLEDetonationPdu

      public boolean isLEDetonationPdu()
      Whether this instance is an LEDetonationPdu
      Returns:
      whether this type of Pdu
    • isLEFirePdu

      public boolean isLEFirePdu()
      Whether this instance is an LEFirePdu
      Returns:
      whether this type of Pdu
    • isLinearObjectStatePdu

      public boolean isLinearObjectStatePdu()
      Whether this instance is an LinearObjectStatePdu
      Returns:
      whether this type of Pdu
    • isLiveEntityDetonationPdu

      public boolean isLiveEntityDetonationPdu()
      Whether this instance is an LiveEntityDetonationPdu
      Returns:
      whether this type of Pdu
    • isLiveEntityFirePdu

      public boolean isLiveEntityFirePdu()
      Whether this instance is an LiveEntityFirePdu
      Returns:
      whether this type of Pdu
    • isMinefieldDataPdu

      public boolean isMinefieldDataPdu()
      Whether this instance is an MinefieldDataPdu
      Returns:
      whether this type of Pdu
    • isMinefieldQueryPdu

      public boolean isMinefieldQueryPdu()
      Whether this instance is an MinefieldQueryPdu
      Returns:
      whether this type of Pdu
    • isMinefieldResponseNACKPdu

      public boolean isMinefieldResponseNACKPdu()
      Whether this instance is an MinefieldResponseNACKPdu
      Returns:
      whether this type of Pdu
    • isMinefieldStatePdu

      public boolean isMinefieldStatePdu()
      Whether this instance is an MinefieldStatePdu
      Returns:
      whether this type of Pdu
    • isPointObjectStatePdu

      public boolean isPointObjectStatePdu()
      Whether this instance is an PointObjectStatePdu
      Returns:
      whether this type of Pdu
    • isReceiverPdu

      public boolean isReceiverPdu()
      Whether this instance is an ReceiverPdu
      Returns:
      whether this type of Pdu
    • isRecordQueryRPdu

      public boolean isRecordQueryRPdu()
      Whether this instance is an RecordQueryRPdu
      Returns:
      whether this type of Pdu
    • isRecordRPdu

      public boolean isRecordRPdu()
      Whether this instance is an RecordRPdu
      Returns:
      whether this type of Pdu
    • isRemoveEntityPdu

      public boolean isRemoveEntityPdu()
      Whether this instance is an RemoveEntityPdu
      Returns:
      whether this type of Pdu
    • isRemoveEntityRPdu

      public boolean isRemoveEntityRPdu()
      Whether this instance is an RemoveEntityRPdu
      Returns:
      whether this type of Pdu
    • isRepairCompletePdu

      public boolean isRepairCompletePdu()
      Whether this instance is an RepairCompletePdu
      Returns:
      whether this type of Pdu
    • isRepairResponsePdu

      public boolean isRepairResponsePdu()
      Whether this instance is an RepairResponsePdu
      Returns:
      whether this type of Pdu
    • isResupplyCancelPdu

      public boolean isResupplyCancelPdu()
      Whether this instance is an ResupplyCancelPdu
      Returns:
      whether this type of Pdu
    • isResupplyOfferPdu

      public boolean isResupplyOfferPdu()
      Whether this instance is an ResupplyOfferPdu
      Returns:
      whether this type of Pdu
    • isResupplyReceivedPdu

      public boolean isResupplyReceivedPdu()
      Whether this instance is an ResupplyReceivedPdu
      Returns:
      whether this type of Pdu
    • isSEESPdu

      public boolean isSEESPdu()
      Whether this instance is an SEESPdu
      Returns:
      whether this type of Pdu
    • isSetDataPdu

      public boolean isSetDataPdu()
      Whether this instance is an SetDataPdu
      Returns:
      whether this type of Pdu
    • isSetDataRPdu

      public boolean isSetDataRPdu()
      Whether this instance is an SetDataRPdu
      Returns:
      whether this type of Pdu
    • isSetRecordRPdu

      public boolean isSetRecordRPdu()
      Whether this instance is an SetRecordRPdu
      Returns:
      whether this type of Pdu
    • isSignalPdu

      public boolean isSignalPdu()
      Whether this instance is an SignalPdu
      Returns:
      whether this type of Pdu
    • isStartResumePdu

      public boolean isStartResumePdu()
      Whether this instance is an StartResumePdu
      Returns:
      whether this type of Pdu
    • isStartResumeRPdu

      public boolean isStartResumeRPdu()
      Whether this instance is an StartResumeRPdu
      Returns:
      whether this type of Pdu
    • isStopFreezePdu

      public boolean isStopFreezePdu()
      Whether this instance is an StopFreezePdu
      Returns:
      whether this type of Pdu
    • isStopFreezeRPdu

      public boolean isStopFreezeRPdu()
      Whether this instance is an StopFreezeRPdu
      Returns:
      whether this type of Pdu
    • isSupplementalEmissionEntityStatePdu

      public boolean isSupplementalEmissionEntityStatePdu()
      Whether this instance is an SupplementalEmissionEntityStatePdu
      Returns:
      whether this type of Pdu
    • isTSPIPdu

      public boolean isTSPIPdu()
      Whether this instance is an TSPIPdu
      Returns:
      whether this type of Pdu
    • isTransferOwnershipPdu

      public boolean isTransferOwnershipPdu()
      Whether this instance is an TransferOwnershipPdu
      Returns:
      whether this type of Pdu
    • isTransmitterPdu

      public boolean isTransmitterPdu()
      Whether this instance is an TransmitterPdu
      Returns:
      whether this type of Pdu
    • isUnderwaterAcousticPdu

      public boolean isUnderwaterAcousticPdu()
      Whether this instance is an UnderwaterAcousticPdu
      Returns:
      whether this type of Pdu
    • copyByPduFactory

      public Pdu copyByPduFactory()
      Create deep copy of current object using PduFactory.
      Returns:
      deep copy of PDU
    • getMarshalledSize

      public int getMarshalledSize()
      Returns size of this serialized (marshalled) object in bytes
      Specified by:
      getMarshalledSize in interface Marshaller
      Returns:
      serialized size in bytes
      See Also:
    • setProtocolVersion

      public Pdu setProtocolVersion(DISProtocolVersion pProtocolVersion)
      Setter for protocolVersion
      Parameters:
      pProtocolVersion - new value of interest
      Returns:
      same object to permit progressive setters
    • getProtocolVersion

      public DISProtocolVersion getProtocolVersion()
      Getter for protocolVersion
      Returns:
      value of interest
    • setExerciseID

      public Pdu setExerciseID(byte pExerciseID)
      Setter for exerciseID
      Parameters:
      pExerciseID - new value of interest
      Returns:
      same object to permit progressive setters
    • setExerciseID

      public Pdu setExerciseID(int pExerciseID)
      Utility setter for exerciseID
      Parameters:
      pExerciseID - new value of interest
      Returns:
      same object to permit progressive setters
    • getExerciseID

      public byte getExerciseID()
      Getter for exerciseID
      Returns:
      value of interest
    • setPduType

      public Pdu setPduType(DisPduType pPduType)
      Setter for pduType
      Parameters:
      pPduType - new value of interest
      Returns:
      same object to permit progressive setters
    • getPduType

      public DisPduType getPduType()
      Getter for pduType
      Returns:
      value of interest
    • setProtocolFamily

      public Pdu setProtocolFamily(DISProtocolFamily pProtocolFamily)
      Setter for protocolFamily
      Parameters:
      pProtocolFamily - new value of interest
      Returns:
      same object to permit progressive setters
    • getProtocolFamily

      public DISProtocolFamily getProtocolFamily()
      Getter for protocolFamily
      Returns:
      value of interest
    • setTimestamp

      public Pdu setTimestamp(int pTimestamp)
      Setter for timestamp Warning: this method sets a DIS bit pattern
      Parameters:
      pTimestamp - new value of interest
      Returns:
      same object to permit progressive setters
      See Also:
    • getTimestamp

      public int getTimestamp()
      Getter for timestamp Warning: this method gets a DIS bit pattern
      Returns:
      value of interest
      See Also:
    • setLength

      public Pdu setLength(short pLength)
      Setter for length
      Parameters:
      pLength - new value of interest
      Returns:
      same object to permit progressive setters
    • setLength

      public Pdu setLength(int pLength)
      Utility setter for length
      Parameters:
      pLength - new value of interest
      Returns:
      same object to permit progressive setters
    • getLength

      public short getLength()
      Getter for length
      Returns:
      value of interest
    • marshal

      public void marshal(DataOutputStream dos) throws Exception
      Serializes an object to a DataOutputStream.
      Specified by:
      marshal in interface Marshaller
      Parameters:
      dos - the OutputStream
      Throws:
      Exception - if something goes wrong
      See Also:
    • unmarshal

      public int unmarshal(DataInputStream dis) throws Exception
      Deserializes an object from a DataInputStream.
      Specified by:
      unmarshal in interface Marshaller
      Parameters:
      dis - the InputStream
      Returns:
      marshalled serialized size in bytes
      Throws:
      Exception - if something goes wrong
      See Also:
    • marshal

      public void marshal(ByteBuffer byteBuffer) throws Exception
      Packs an object into the ByteBuffer.
      Specified by:
      marshal in interface Marshaller
      Parameters:
      byteBuffer - The ByteBuffer at the position to begin writing
      Throws:
      BufferOverflowException - if byteBuffer is too small
      ReadOnlyBufferException - if byteBuffer is read only
      Exception - ByteBuffer-generated exception
      See Also:
    • unmarshal

      public int unmarshal(ByteBuffer byteBuffer) throws Exception
      Unpacks a Pdu from the underlying data.
      Specified by:
      unmarshal in interface Marshaller
      Parameters:
      byteBuffer - The ByteBuffer at the position to begin reading
      Returns:
      marshalled serialized size in bytes
      Throws:
      BufferUnderflowException - if byteBuffer is too small
      Exception - ByteBuffer-generated exception
      See Also:
    • marshal

      public ByteBuffer marshal() throws Exception
      A convenience method for marshalling to a ByteBuffer
      Returns:
      a ByteBuffer with the marshalled Pdu
      Throws:
      Exception - ByteBuffer-generated exception
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • equalsImpl

      public boolean equalsImpl(Object obj)
      Compare all fields that contribute to the state, ignoring transient and static fields, for this and the supplied object
      Parameters:
      obj - the object to compare to
      Returns:
      true if the objects are equal, false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • setTimestampSeconds

      public Pdu setTimestampSeconds(double newTimestamp)
      Utility setter for timestamp converting double (or float) to Timestamp in seconds at 2^31 - 1 units past top of hour
      Parameters:
      newTimestamp - new timestamp in seconds
      Returns:
      same object to permit progressive setters
      See Also:
    • getTimestampSeconds

      public double getTimestampSeconds()
      Utility getter for timestamp converting integer timestamp at 2^31 - 1 units past top of hour to double (or float)
      Returns:
      fractional timestamp past hour
      See Also:
    • occursAfter

      public boolean occursAfter(Pdu pdu2)
      Whether or not timestamp for this Pdu occurs after timestamp as another Pdu.
      Parameters:
      pdu2 - second Pdu for comparison
      Returns:
      whether timestamp for this Pdu occurs later
    • occursBefore

      public boolean occursBefore(Pdu pdu2)
      Whether or not timestamp for this Pdu occurs before timestamp as another Pdu.
      Parameters:
      pdu2 - second Pdu for comparison
      Returns:
      whether timestamp for this Pdu occurs earlier
    • occursSameTime

      public boolean occursSameTime(Pdu pdu2)
      Whether or not this Pdu occurs at same timestamp as another Pdu.
      Parameters:
      pdu2 - second Pdu for comparison
      Returns:
      whether timestamps are identical for both Pdus