mil.navy.nps.dis
Class CommentPdu

java.lang.Object
  extended bymil.navy.nps.dis.PduElement
      extended bymil.navy.nps.dis.ProtocolDataUnit
          extended bymil.navy.nps.dis.SimulationManagementFamily
              extended bymil.navy.nps.dis.CommentPdu
All Implemented Interfaces:
java.lang.Cloneable, SerializationInterface

public class CommentPdu
extends SimulationManagementFamily

Comment message PDU.

Version:
1.0
Author:
Don McGregor (http://www.npsnet.org/~mcgredo)
Location:
Web: http://www.web3d.org/WorkingGroups/vrtp/mil/navy/nps/dis/CommentPdu.java
or locally: ~/mil/navy/nps/dis/CommentPdu.java
Hierarchy Diagram:
Summary:
The CommentPdu is used to send arbitrary messages, such as character strings.
Explanation:
The specificatrion says: "Arbitrary messages (character strings, for example) shall be entered into data stream by using a Comment PDU".

This has a header section, which is inherited from the Simulation management PDU abstract class which contains the header information. After that, the PDU consists of counts of the number of fixed and variable datum records, and the records themselves.

The commentPDU will be implemented using the Datum Specification record despite it does not have one. The thing is it has an amputated part of it. It has a Datum Specification with no Fixed Datum data fields. So we are going to use the Datum Specification with proper care to ensure that will not ever exist in this PDU Fixed Datum values. IF modification are done, pay atention to setDatumSpecification method, because it is reponsible for maintaining this integrity, and is a little bit different from other classes accessor methods.

Note:
Here we implement a datumSpecification instead of the Number of Variable Datum fields and the variable Datum Record as in the specification.
History:
9 December 96 /Don McGregor /New
10 March 97 /Don McGregor /Cleaned up for javadoc
16 April 97 /Don McGregor /PrintStream passed to printValues
6 May 97 /Don McGregor /Bug fixed in deSerialize; attempting to get int value of unsigned
int, also a stray semicolon at end of for statement.
16 September 97 /Antonio Alexandre Rua /header inherited from Simulation Management+use setDatumSpecification
8 December 97 /Ronan Fauglas /changes for documentation templates + complements in documentation
11 December 97 /Ronan Fauglas /changed access methods: thisVariable() --> getThisVariable()
5 January 98 /Ronan Fauglas /changed DatumSpecification to protected.
29 November 99 /Don Brutzman /changed PduTypeField.MESSAGE->PduTypeField.COMMENT
References:
DIS-Java-VRML Working Group: http://www.web3d.org/WorkingGroups/vrtp/dis-java-vrml/
DIS Data Dictionary:Comment PDU
DIS specification: IEEE 1278.1, 5.4.6.12, 4.4.5.4.12
See Also:
ProtocolDataUnit, PduElement, SerializationInterface, DatumSpecification, CreateEntityPdu, RemoveEntityPdu, StartResumePdu, StopFreezePdu, AcknowledgePdu, ActionRequestPdu, ActionResponsePdu, DataQueryPdu, SetDataPdu, DataPdu, EventReportPdu, CommentPdu

Field Summary
protected  DatumSpecification datumSpecification
          This represents represents the number of fixed datum, the number of variable datum, and the variable datum values.
protected static CommentPdu exemplar
          An "exemplar" object, which is filled out to the state that is needed most of the time.
 
Fields inherited from class mil.navy.nps.dis.SimulationManagementFamily
originatingEntityID, receivingEntityID, sizeOf
 
Fields inherited from class mil.navy.nps.dis.ProtocolDataUnit
DEBUG, exerciseID, pduType, protocolFamily, protocolVersion, timeReceived, timestamp
 
Constructor Summary
CommentPdu()
          Default constructor--fills with zeros for all values.
 
Method Summary
 java.lang.Object clone()
          Makes deep copies of all the instance variables, so we don't have two objects pointing to the same data.
 void deSerialize(java.io.DataInputStream inputStream)
          Deserialize our data from the input stream.
 DatumSpecification getDatumSpecification()
           
 CommentPdu getExemplar()
           
 int length()
          Returns the length of the PDU header.
 java.lang.String pduName()
          Returns the name of this PDU
 void printValues(int indentLevel, java.io.PrintStream printStream)
          Prints the generated serialized object for debugging.
 void serialize(java.io.DataOutputStream outputStream)
          Serialize our data out to the stream.
 void setDatumSpecification(DatumSpecification pDatumSpecification)
          Note: the fixed List is automatically suppressed by the method.
 void setExemplar(CommentPdu newExemplar)
           
 
Methods inherited from class mil.navy.nps.dis.SimulationManagementFamily
getOriginatingEntityID, getReceivingEntityID, setOriginatingEntityID, setReceivingEntityID
 
Methods inherited from class mil.navy.nps.dis.ProtocolDataUnit
byteArrayToPdu, datagramToPdu, debug, getExerciseID, getPaddingOfLength, getPduType, getProtocolFamily, getProtocolVersion, getRtpHeaderEnabled, getTimeReceived, getTimestamp, getVRMLTimestamp, makeTimestampCurrent, setExerciseID, setExerciseID, setPduType, setPduType, setProtocolFamily, setProtocolFamily, setProtocolVersion, setProtocolVersion, setRtpHeaderEnabled, setSimulationStartTime, setTimeReceived, setTimestamp, setTimestamp, stampTimeReceived, toString, trace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

datumSpecification

protected DatumSpecification datumSpecification
This represents represents the number of fixed datum, the number of variable datum, and the variable datum values. Note: This is actually a truncated datum specification record where we don't make use of the fixed datum record.


exemplar

protected static CommentPdu exemplar
An "exemplar" object, which is filled out to the state that is needed most of the time.
Explanation
A brand new object has to have most of its values set, such as the forceID, protocol version, and so on. This lets the user fill out most of the values, save it in the class, then retrieve a copy of it as needed.

Constructor Detail

CommentPdu

public CommentPdu()
Default constructor--fills with zeros for all values.

Method Detail

pduName

public java.lang.String pduName()
Description copied from class: SimulationManagementFamily
Returns the name of this PDU

Specified by:
pduName in class SimulationManagementFamily
Returns:
the name of this PDU

serialize

public void serialize(java.io.DataOutputStream outputStream)
Description copied from class: PduElement
Serialize our data out to the stream. Subclasses of us should call super.Serialize() to make sure the superclasse's data is serialized out. The order in which instance variables are serialized is significant. They must be serialized in the same order they appear in the DIS spec. Prints out some information during execution if debugging flag is set.

Specified by:
serialize in interface SerializationInterface
Overrides:
serialize in class SimulationManagementFamily

deSerialize

public void deSerialize(java.io.DataInputStream inputStream)
Description copied from class: PduElement
Deserialize our data from the input stream. Subclasses of us should call super.deSerialize to make sure the superclass's data are properly affected. The order in which instance variables are serialized is significant. They must be deSerialized in the same order as they have been serialized as specified by the DIS spec.

Specified by:
deSerialize in interface SerializationInterface
Overrides:
deSerialize in class SimulationManagementFamily

clone

public java.lang.Object clone()
Description copied from class: PduElement
Makes deep copies of all the instance variables, so we don't have two objects pointing to the same data. The accessor methods make copies of the objects, rather than returning the objects themselves. The runtime provides the right object type with the call to super.clone(), and we cast it to our type. Subclasses should do the same thing, and all these ivars will be taken care of automatically.

Overrides:
clone in class SimulationManagementFamily

length

public int length()
Description copied from class: ProtocolDataUnit
Returns the length of the PDU header.

Overrides:
length in class SimulationManagementFamily

printValues

public void printValues(int indentLevel,
                        java.io.PrintStream printStream)
Description copied from class: PduElement
Prints the generated serialized object for debugging.

Overrides:
printValues in class SimulationManagementFamily

getExemplar

public CommentPdu getExemplar()

setExemplar

public void setExemplar(CommentPdu newExemplar)

getDatumSpecification

public DatumSpecification getDatumSpecification()

setDatumSpecification

public void setDatumSpecification(DatumSpecification pDatumSpecification)
Note: the fixed List is automatically suppressed by the method.