/* File: RemoveEntityPdu.java CVS Info: $Id: RemoveEntityPdu.java,v 1.3 1998/01/28 08:28:22 mcgredo Exp $ Compiler: jdk 1.3 */ package mil.navy.nps.dis; // package to which we belong import mil.navy.nps.util.*; // General-purpose utilities import mil.navy.nps.disEnumerations.*; // Enumerations for DIS import java.util.*; // utility stuff we need import java.io.*; // input/output for serialization /** * Simulation management PDU to remove an entity from the exercise. * *@version 1.0 *@author Antonio Alexandre Rua (http://www.garfield.fe.up.pt/~alexrua) * *
Location: *
Web: * http://www.web3d.org/WorkingGroups/vrtp/mil/navy/nps/dis/RemoveEntityPdu.java * *
or locally: * ~/mil/navy/nps/dis/RemoveEntityPdu.java * *
Hierarchy Diagram: *
* *
Summary: *
The removal of an entity from an exercise shall be communicated with a Remove Entity PDU. * *
History: *
16Sep97 /Antonio Alexandre Rua /New *
8Dec97 /Ronan Fauglas /changes for documentation templates + complements in documentation *
11Dec97 /Ronan Fauglas /changed access methods: thisVariable() --> getThisVariable() * *
References: *
DIS Data Dictionary : * Remove Entity PDU *
DIS-Java-VRML Working Group: * http://www.web3d.org/WorkingGroups/vrtp/dis-java-vrml/ *
DIS specification : IEEE 1278.1, 5.4.6.2 * *@see ProtocolDataUnit *@see PduElement *@see SerializationInterface */ public class RemoveEntityPdu extends SimulationManagementFamily { /** *Request ID - This field shall identify the specific and unique entity removal request being made *by the simulation manager. This field shall be represented by a 32-bit unsigned integer. * *
References: *
DIS Data Dictionary: Request ID Field */ private UnsignedInt requestID; //identifies entity creation request by SM /** *Constant value--total size of an Action Request PDU including header *sizeOf = 28 bytes */ public static final int sizeOf = 28; // The total size of PDU is known /** *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. *
*/ static protected RemoveEntityPdu exemplar; /** *Default constructor. Initializes everything to zero, basically. */ public RemoveEntityPdu() // default constructor { setPduType(PduTypeField.REMOVEENTITY); requestID = new UnsignedInt(); return; } public void serialize(DataOutputStream outputStream) { /** Serialize our data out to the stream. We first call the superclass, so that all the data there is written out to the buffer first. Then we serialize each of our ivars to the stream, being careful about the order. */ // takes care of all the header variables in the two consecutive superclasses super.serialize(outputStream); // write out ivars requestID.serialize(outputStream); return; } public void deSerialize(DataInputStream inputStream) { /** deserialize our data from the stream. We first call the superclass, so that all the data there is read into the buffer first. Then we deserialize each of our ivars to the stream, being careful about the order. */ super.deSerialize(inputStream); // Do our ivars requestID.deSerialize(inputStream); return; } public Object clone() { RemoveEntityPdu newPdu = (RemoveEntityPdu)super.clone(); // new Create Entity Pdu pdu newPdu.setRequestID(this.getRequestID()); return newPdu; } public int length() { return sizeOf; } public String pduName() { return new String("Create Entity PDU"); } public void printValues(int indentLevel, PrintStream printStream) { // print the values of the object out, with correct level of // indentation on the page. StringBuffer indent = ProtocolDataUnit.getPaddingOfLength(indentLevel); int idx, superclassIndent = indentLevel; printStream.println(); printStream.println("Remove Entity PDU"); // ugly wart: get the superclass over to the left a couple pixels, if we have any to spare, // so the header info will be indented a bit less. if(superclassIndent > 0) superclassIndent -= 1; super.printValues(superclassIndent, printStream); printStream.println(indent + "Request ID: "+requestID.longValue()); return; } public RemoveEntityPdu getExemplar() { return (RemoveEntityPdu)exemplar.clone(); } public void setExemplar(RemoveEntityPdu newExemplar) { exemplar = newExemplar; } // Accessor methods public UnsignedInt getRequestID() { return (UnsignedInt)requestID.clone(); } public void setRequestID(UnsignedInt pRequestID) { requestID = pRequestID; } public void setRequestID(long pRequestID) { requestID = new UnsignedInt(pRequestID); } } // end of class RemoveEntityPdu