/* File: *.java CVS Info: $Id: StyleTemplate.java.txt,v 1.1.1.1 1998/01/22 21:35:14 mcgredo Exp $ Compiler: jdk 1.3 */ package mil.navy.nps.dis; import java.lang.*; import java.util.*; import java.io.*; /** * Summary one-sentence description of class functionality. * *@version 1.0 *@author Don McGregor (http://www.stl.nps.navy.mil/~mcgredo) * *
Location: *
* ~/mil/navy/nps/dis/.java * *
* http://devo.stl.nps.navy.mil/dis-java-vrml/mil/navy/nps/dis/.java *
* http://www.web3D.org/WorkingGroups/vrtp/dis-java-vrml/mil/navy/nps/dis/yourClassName.java * *
Hierarchy Diagram: *
* *
History: * * *
[date] * [name] * [comments] *
*

* *

References: *
DIS Data Dictionary: * Linear Acceleration Vector Record *
DIS specification : IEEE 1278.1, 5.3.33.2 * *@see PduElement *@see SerializationInterface */ public class Acceleration extends PduElement { /** * *
*
Value: *
Enumeration, see references below for values. *
References: *
DIS Data Dictionary: * Acknowledge Flag Field *
DIS specification : IEEE 1278.1, *
See Section in EBV-DOC *
*/ protected ...; // x-position /** *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 AcknowledgePdu exemplar; /** *Constant value--size of a when written out on the wire; here :sizeOf = bytes. */ public final int sizeOf = ...; // object is ... bytes long /** *Default constructor--fills with zeros for all values. */ public Acceleration() { // default constructor x = 0; y = 0; z = 0; return; } /** *Constructs a new Acceleration object whose coordinate values are passed in parameters. * *@param pX the first coordinate in the cartesian coordinate system *@param pY the second coordinate in the cartesian coordinate system *@param pZ the third coordinate in the cartesian coordinate system */ public Acceleration(float pX, float pY, float pZ) { x = pX; y = pY; z = pZ; return; } public Object clone() { Acceleration newAcceleration = new Acceleration(x, y, z); return newAcceleration; } /** *@excetion RuntimeException when IO error occurs. */ public void serialize(DataOutputStream outputStream) { // write out the data to an output stream. Order is important here, since // it needs to conform to the DIS standard. //super.serialize(outputStream); // No need to call super, since no ivars are in our direct superclass try { outputStream.writeFloat(x); outputStream.writeFloat(y); outputStream.writeFloat(z); } catch (IOException ioError) { throw new RuntimeException("Exception in Acceleration. Error writing to wire."); } } public void deSerialize(DataInputStream pInputStream) { try { x = pInputStream.readFloat(); y = pInputStream.readFloat(); z = pInputStream.readFloat(); } catch (IOException ioError) { throw new RuntimeException("Exception in Acceleration. Error reading from wire."); } } public int length() { return sizeOf; // EntityTypes are this long, always. } public void printValues(int indentLevel, PrintStream printStream) { // print the values of the object out, with correct level of // indentation on the page. char[] indent = new char[indentLevel]; int idx = 0; String spacing; for(idx = 0; idx < indentLevel; idx++) indent[idx] = ' '; spacing = new String(indent); printStream.println(indent + "acceleration x: " + x); printStream.println(indent + "acceleration y: " + y); printStream.println(indent + "acceleration z: " + z); return; } // Accessor methods public void setValues(float pX, float pY, float pZ) { x = pX; y = pY; z = pZ; } public float getX() { return x; } public void setX(float pX) {x = pX; } public float getY() { return y; } public void setY(float pY) {y = pY; } public float getZ() { return z; } public void setZ(float pZ) {z = pZ; } } // end of class Acceleration